Update str8 printf spec
Release / release (push) Successful in 4s

This commit is contained in:
Abdelrahman Said
2026-09-16 21:34:56 +01:00
parent 605c1ddfae
commit 9029e21a4f
7 changed files with 10 additions and 9 deletions
+1
View File
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Switched to using `wpMiscUtilsRotl64` in `xorshift` - Switched to using `wpMiscUtilsRotl64` in `xorshift`
- Remove all uses of names starting with underscore - Remove all uses of names starting with underscore
- Ensure `wpArrayClear` memsets members to 0 - Ensure `wpArrayClear` memsets members to 0
- Removed '%' from `WP_STR8_SPEC`
## [2.4.0] - 2026-08-30 ## [2.4.0] - 2026-08-30
+4 -4
View File
@@ -32,17 +32,17 @@ typedef struct WpSipHasherData {
} WpSipHasherData; } WpSipHasherData;
#ifdef WP_PLATFORM_CPP #ifdef WP_PLATFORM_CPP
#define wpSip24HasherData(KEY) (WpSipHasherData{KEY, WP_SIP_HASHER_MAGIC, 2, 4}) #define wpSip24HasherData(KEY) (WpSipHasherData{(KEY), WP_SIP_HASHER_MAGIC, 2, 4})
#define wpSip48HasherData(KEY) (WpSipHasherData{KEY, WP_SIP_HASHER_MAGIC, 4, 8}) #define wpSip48HasherData(KEY) (WpSipHasherData{(KEY), WP_SIP_HASHER_MAGIC, 4, 8})
#else #else
#define wpSip24HasherData(KEY) ((WpSipHasherData){ \ #define wpSip24HasherData(KEY) ((WpSipHasherData){ \
.key = KEY, \ .key = (KEY), \
.magic = WP_SIP_HASHER_MAGIC, \ .magic = WP_SIP_HASHER_MAGIC, \
.compression = 2, \ .compression = 2, \
.finalisation = 4, \ .finalisation = 4, \
}) })
#define wpSip48HasherData(KEY) ((WpSipHasherData){ \ #define wpSip48HasherData(KEY) ((WpSipHasherData){ \
.key = KEY, \ .key = (KEY), \
.magic = WP_SIP_HASHER_MAGIC, \ .magic = WP_SIP_HASHER_MAGIC, \
.compression = 4, \ .compression = 4, \
.finalisation = 8, \ .finalisation = 8, \
+1 -1
View File
@@ -27,7 +27,7 @@ typedef const WpStr8 WpStr8RO;
/** /**
* Utilities to be used with printf functions * Utilities to be used with printf functions
*/ */
#define WP_STR8_SPEC "%.*s" #define WP_STR8_SPEC ".*s"
#define wpStr8Varg(STRING) (int)((STRING).size), (STRING).buf #define wpStr8Varg(STRING) (int)((STRING).size), (STRING).buf
/** /**
+1 -1
View File
@@ -94,7 +94,7 @@ wp_intern WpCmdError getCommandOutput(FILE *fp, WpCmdOutHandling out_handling, W
wpStr8ConcatCapped(out_buf, &out); wpStr8ConcatCapped(out_buf, &out);
} else if (out_handling == WP_SHELL_OUTPUT_PRINT) { } else if (out_handling == WP_SHELL_OUTPUT_PRINT) {
printf(WP_STR8_SPEC, wpStr8Varg(out)); printf("%" WP_STR8_SPEC, wpStr8Varg(out));
} }
return WP_SHELL_ERR_NO_ERROR; return WP_SHELL_ERR_NO_ERROR;
@@ -30,7 +30,7 @@ wp_intern WpStr8RO colours[COUNT_TERM_COLOUR] = {
}; };
void printColouredText(WpStr8RO *text, WpTerminalColour colour) { void printColouredText(WpStr8RO *text, WpTerminalColour colour) {
printf(WP_STR8_SPEC WP_STR8_SPEC, wpStr8Varg(colours[colour]), wpStr8Varg((*text))); printf("%" WP_STR8_SPEC "%" WP_STR8_SPEC, wpStr8Varg(colours[colour]), wpStr8Varg((*text)));
} }
#endif // !WP_PLATFORM_POSIX #endif // !WP_PLATFORM_POSIX
+1 -1
View File
@@ -56,7 +56,7 @@ void printColouredText(WpStr8RO *text, WpTerminalColour colour) {
} }
SetConsoleTextAttribute(data.handle, data.current_colour); SetConsoleTextAttribute(data.handle, data.current_colour);
printf(WP_STR8_SPEC, wpStr8Varg((*text))); printf("%" WP_STR8_SPEC, wpStr8Varg((*text)));
} }
wp_intern void initData(TermcolourData *data) { wp_intern void initData(TermcolourData *data) {
+1 -1
View File
@@ -47,7 +47,7 @@ wp_intern void handleTestResult(WpTestFuncResult result) {
printf("["); printf("[");
wpShellTermcolourPrintText(&result_text, colour); wpShellTermcolourPrintText(&result_text, colour);
wpShellTermcolourClearColour(); wpShellTermcolourClearColour();
printf("] " WP_STR8_SPEC "\n", wpStr8Varg(result.name)); printf("] %" WP_STR8_SPEC "\n", wpStr8Varg(result.name));
if (!result.passed) { if (!result.passed) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);