X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fstring-utils%2Fstring-utils.c;h=1bf0cc060f9960fe46e84611bea13cab5a30b0ce;hb=ca806b0b247f89c62ac628a7779ae84049a8c2d7;hp=669f7d05fd01c64513b68128a740c8940fdcaa9d;hpb=e358ddd51a5be6017f524523ac10d7c17fb78f65;p=lttng-tools.git diff --git a/src/common/string-utils/string-utils.c b/src/common/string-utils/string-utils.c index 669f7d05f..1bf0cc060 100644 --- a/src/common/string-utils/string-utils.c +++ b/src/common/string-utils/string-utils.c @@ -9,7 +9,6 @@ #include #include #include -#include #include "string-utils.h" #include "../macros.h" @@ -24,14 +23,13 @@ enum star_glob_pattern_type_flags { * Normalizes the star-only globbing pattern `pattern`, that is, crushes * consecutive `*` characters into a single `*`, avoiding `\*`. */ -LTTNG_HIDDEN void strutils_normalize_star_glob_pattern(char *pattern) { const char *p; char *np; bool got_star = false; - assert(pattern); + LTTNG_ASSERT(pattern); for (p = pattern, np = pattern; *p != '\0'; p++) { switch (*p) { @@ -75,7 +73,7 @@ enum star_glob_pattern_type_flags strutils_test_glob_pattern(const char *pattern STAR_GLOB_PATTERN_TYPE_FLAG_NONE; const char *p; - assert(pattern); + LTTNG_ASSERT(pattern); for (p = pattern; *p != '\0'; p++) { switch (*p) { @@ -107,7 +105,6 @@ end: * Returns true if `pattern` is a star-only globbing pattern, that is, * it contains at least one non-escaped `*`. */ -LTTNG_HIDDEN bool strutils_is_star_glob_pattern(const char *pattern) { return strutils_test_glob_pattern(pattern) & @@ -118,7 +115,6 @@ bool strutils_is_star_glob_pattern(const char *pattern) * Returns true if `pattern` is a globbing pattern with a globbing, * non-escaped star only at its very end. */ -LTTNG_HIDDEN bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern) { return strutils_test_glob_pattern(pattern) & @@ -130,14 +126,13 @@ bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern) * removes `\`. If `only_char` is not 0, only this character is * escaped. */ -LTTNG_HIDDEN char *strutils_unescape_string(const char *input, char only_char) { char *output; char *o; const char *i; - assert(input); + LTTNG_ASSERT(input); output = zmalloc(strlen(input) + 1); if (!output) { goto end; @@ -175,7 +170,6 @@ end: * Frees a null-terminated array of strings, including each contained * string. */ -LTTNG_HIDDEN void strutils_free_null_terminated_array_of_strings(char **array) { char **item; @@ -241,7 +235,6 @@ void strutils_free_null_terminated_array_of_strings(char **array) * * Returns -1 if there's an error. */ -LTTNG_HIDDEN int strutils_split(const char *input, char delim, bool escape_delim, @@ -254,9 +247,9 @@ int strutils_split(const char *input, const char *s; const char *last; - assert(input); - assert(!(escape_delim && delim == '\\')); - assert(delim != '\0'); + LTTNG_ASSERT(input); + LTTNG_ASSERT(!(escape_delim && delim == '\\')); + LTTNG_ASSERT(delim != '\0'); lttng_dynamic_pointer_array_init(out_strings, free); /* First pass: count the number of substrings. */ @@ -356,13 +349,12 @@ end: return ret; } -LTTNG_HIDDEN size_t strutils_array_of_strings_len(char * const *array) { char * const *item; size_t count = 0; - assert(array); + LTTNG_ASSERT(array); for (item = array; *item; item++) { count++;