[Bf-blender-cvs] [4bf3ca20165] master: Cleanup: replace elem_strcmp with elem_streq
Campbell Barton
noreply at git.blender.org
Sat Aug 8 05:38:54 CEST 2020
Commit: 4bf3ca20165959f98c7c830a138ba2901d3dd851
Author: Campbell Barton
Date: Sat Aug 8 12:33:41 2020 +1000
Branches: master
https://developer.blender.org/rB4bf3ca20165959f98c7c830a138ba2901d3dd851
Cleanup: replace elem_strcmp with elem_streq
This is used for equality and didn't have the same behavior as strcmp.
===================================================================
M source/blender/makesdna/intern/dna_genfile.c
===================================================================
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 00ec765bfa9..8ad0271f355 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -937,13 +937,13 @@ static void cast_pointer(
/**
* Equality test on name and oname excluding any array-size suffix.
*/
-static int elem_strcmp(const char *name, const char *oname)
+static bool elem_streq(const char *name, const char *oname)
{
int a = 0;
while (1) {
if (name[a] != oname[a]) {
- return 1;
+ return false;
}
if (name[a] == '[' || oname[a] == '[') {
break;
@@ -953,7 +953,7 @@ static int elem_strcmp(const char *name, const char *oname)
}
a++;
}
- return 0;
+ return true;
}
/**
@@ -984,8 +984,8 @@ static bool elem_exists_impl(
otype = types[old[0]];
oname = names[old[1]];
- if (elem_strcmp(name, oname) == 0) { /* name equal */
- return STREQ(type, otype); /* type equal */
+ if (elem_streq(name, oname)) { /* name equal */
+ return STREQ(type, otype); /* type equal */
}
}
return false;
@@ -1060,8 +1060,8 @@ static const char *find_elem(const SDNA *sdna,
len = DNA_elem_size_nr(sdna, old[0], old[1]);
- if (elem_strcmp(name, oname) == 0) { /* name equal */
- if (STREQ(type, otype)) { /* type equal */
+ if (elem_streq(name, oname)) { /* name equal */
+ if (STREQ(type, otype)) { /* type equal */
if (sppo) {
*sppo = old;
}
More information about the Bf-blender-cvs
mailing list