X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommon%2Fstring-utils%2Fstring-utils.cpp;h=d172aeb4b0fd69aaf3284e00283c2cdcab9cd5ce;hb=e2c2bec23d72b09ef5778dff54fa6ca4a34587bf;hp=d23cf794cb34b0edb7da097f4393b4bced4fb8bb;hpb=d50d200af8d01f4b58a14e384cabd46b1afb4817;p=lttng-tools.git diff --git a/src/common/string-utils/string-utils.cpp b/src/common/string-utils/string-utils.cpp index d23cf794c..d172aeb4b 100644 --- a/src/common/string-utils/string-utils.cpp +++ b/src/common/string-utils/string-utils.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2017 Philippe Proulx * - * SPDX-License-Identifier: GPL-2.0-only + * SPDX-License-Identifier: LGPL-2.1-only * */ @@ -15,8 +15,8 @@ #include #include -#include "string-utils.h" -#include "../macros.h" +#include "string-utils.hpp" +#include "../macros.hpp" enum star_glob_pattern_type_flags { STAR_GLOB_PATTERN_TYPE_FLAG_NONE = 0, @@ -66,7 +66,7 @@ void strutils_normalize_star_glob_pattern(char *pattern) goto end; } - /* Fall through default case. */ + /* fall through */ default: got_star = false; break; @@ -148,7 +148,7 @@ char *strutils_unescape_string(const char *input, char only_char) const char *i; LTTNG_ASSERT(input); - output = (char *) zmalloc(strlen(input) + 1); + output = calloc(strlen(input) + 1); if (!output) { goto end; } @@ -299,7 +299,7 @@ int strutils_split(const char *input, for (at = 0, s = input; at < number_of_substrings; at++) { const char *ss; char *d; - char *substring = (char *) zmalloc(longest_substring_len + 1); + char *substring = calloc(longest_substring_len + 1); if (!substring) { goto error; @@ -385,7 +385,7 @@ int strutils_append_str(char **s, const char *append) size_t oldlen = (old == NULL) ? 0 : strlen(old); size_t appendlen = strlen(append); - new_str = (char *) zmalloc(oldlen + appendlen + 1); + new_str = zmalloc(oldlen + appendlen + 1); if (!new_str) { return -ENOMEM; } @@ -415,7 +415,7 @@ int strutils_appendf(char **s, const char *fmt, ...) } /* Allocate space for old string + new string + \0. */ - new_str = (char *) zmalloc(oldlen + ret + 1); + new_str = zmalloc(oldlen + ret + 1); if (!new_str) { ret = -ENOMEM; goto end;