Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-08-12 04:59:16 +0300
committerHans Goudey <h.goudey@me.com>2020-08-12 04:59:16 +0300
commitef11238c743e6985fe325280fb13e05d6ec27378 (patch)
tree1dd2605a676bee52296535825b99f000a9c255eb /source/blender/blenlib/intern/string.c
parent1f768bbe4145daed111636ca09dd53b25b8d29b5 (diff)
parentec5f39208785c1bbe723054ffe69e1ac2ab470dd (diff)
Merge branch 'master' into property-search-uiproperty-search-ui
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index abdae06acd5..755637ac274 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -87,7 +87,7 @@ char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
str = MEM_mallocN(str1_len + str2_len, "strdupcat");
s = str;
- memcpy(s, str1, str1_len);
+ memcpy(s, str1, str1_len); /* NOLINT: bugprone-not-null-terminated-result */
s += str1_len;
memcpy(s, str2, str2_len);
@@ -394,9 +394,7 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
if (LIKELY(*(endMatch - 1) != '\\')) {
break;
}
- else {
- endMatch++;
- }
+ endMatch++;
}
if (endMatch) {
@@ -470,11 +468,9 @@ char *BLI_str_replaceN(const char *__restrict str,
return str_new;
}
- else {
- /* Just create a new copy of the entire string - we avoid going through the assembly buffer
- * for what should be a bit more efficiency. */
- return BLI_strdup(str);
- }
+ /* Just create a new copy of the entire string - we avoid going through the assembly buffer
+ * for what should be a bit more efficiency. */
+ return BLI_strdup(str);
}
/**
@@ -518,7 +514,7 @@ char *BLI_strcasestr(const char *s, const char *find)
do {
do {
if ((sc = *s++) == 0) {
- return (NULL);
+ return NULL;
}
sc = tolower(sc);
} while (sc != c);
@@ -574,10 +570,10 @@ int BLI_strcasecmp(const char *s1, const char *s2)
if (c1 < c2) {
return -1;
}
- else if (c1 > c2) {
+ if (c1 > c2) {
return 1;
}
- else if (c1 == 0) {
+ if (c1 == 0) {
break;
}
}
@@ -597,10 +593,10 @@ int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
if (c1 < c2) {
return -1;
}
- else if (c1 > c2) {
+ if (c1 > c2) {
return 1;
}
- else if (c1 == 0) {
+ if (c1 == 0) {
break;
}
}
@@ -627,15 +623,13 @@ static int left_number_strcmp(const char *s1, const char *s2, int *tiebreaker)
if (isdigit(*(p1 + numdigit)) && isdigit(*(p2 + numdigit))) {
continue;
}
- else if (isdigit(*(p1 + numdigit))) {
+ if (isdigit(*(p1 + numdigit))) {
return 1; /* s2 is bigger */
}
- else if (isdigit(*(p2 + numdigit))) {
+ if (isdigit(*(p2 + numdigit))) {
return -1; /* s1 is bigger */
}
- else {
- break;
- }
+ break;
}
/* same number of digits, compare size of number */
@@ -759,14 +753,14 @@ int BLI_strcmp_ignore_pad(const char *str1, const char *str2, const char pad)
if (str1_len == str2_len) {
return strncmp(str1, str2, str2_len);
}
- else if (str1_len > str2_len) {
+ if (str1_len > str2_len) {
int ret = strncmp(str1, str2, str2_len);
if (ret == 0) {
ret = 1;
}
return ret;
}
- else {
+ {
int ret = strncmp(str1, str2, str1_len);
if (ret == 0) {
ret = -1;