diff options
Diffstat (limited to '')
-rw-r--r-- | libnetdata/string/string.c | 6 | ||||
-rw-r--r-- | libnetdata/string/string.h | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/libnetdata/string/string.c b/libnetdata/string/string.c index 54b8f171f..e1c8352a5 100644 --- a/libnetdata/string/string.c +++ b/libnetdata/string/string.c @@ -338,10 +338,6 @@ inline const char *string2str(STRING *string) { return string->str; } -int string_strcmp(STRING *string, const char *s) { - return strcmp(string2str(string), s); -} - STRING *string_2way_merge(STRING *a, STRING *b) { static STRING *X = NULL; @@ -420,7 +416,7 @@ static char **string_unittest_generate_names(size_t entries) { char **names = mallocz(sizeof(char *) * entries); for(size_t i = 0; i < entries ;i++) { char buf[25 + 1] = ""; - snprintfz(buf, 25, "name.%zu.0123456789.%zu \t !@#$%%^&*(),./[]{}\\|~`", i, entries / 2 + i); + snprintfz(buf, sizeof(buf) - 1, "name.%zu.0123456789.%zu \t !@#$%%^&*(),./[]{}\\|~`", i, entries / 2 + i); names[i] = strdupz(buf); } return names; diff --git a/libnetdata/string/string.h b/libnetdata/string/string.h index 70840ee9a..ba0e3876b 100644 --- a/libnetdata/string/string.h +++ b/libnetdata/string/string.h @@ -13,7 +13,6 @@ STRING *string_dup(STRING *string); void string_freez(STRING *string); size_t string_strlen(STRING *string); const char *string2str(STRING *string) NEVERNULL; -int string_strcmp(STRING *string, const char *s); // keep common prefix/suffix and replace everything else with [x] STRING *string_2way_merge(STRING *a, STRING *b); @@ -24,6 +23,10 @@ static inline int string_cmp(STRING *s1, STRING *s2) { return (s1 == s2)?0:strcmp(string2str(s1), string2str(s2)); } +static inline int string_strcmp(STRING *string, const char *s) { + return strcmp(string2str(string), s); +} + void string_statistics(size_t *inserts, size_t *deletes, size_t *searches, size_t *entries, size_t *references, size_t *memory, size_t *duplications, size_t *releases); int string_unittest(size_t entries); |