string_utils: add trim_both

trim_both removes whitespaces from both side of a string.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2022-07-17 15:30:42 +01:00
parent e757a6461d
commit 7e833744b7
3 changed files with 30 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ struct test_file_metadata __attribute__((weak)) * test_file_head;
const char *part2 = " != " #b; \
size_t len2 = len + strlen(part2) + 3; \
char *buf = malloc(len2); \
snprintf(buf, len2, "\"%.*s\"%s", len, a, part2); \
snprintf(buf, len2, "\"%.*s\"%s", (int)len, a, part2); \
SET_FAILURE(buf, true); \
return; \
} \