Avoid per-constraint-target call of strlen
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 May 2016 15:15:16 +0000 (17:15 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 May 2016 15:15:16 +0000 (17:15 +0200)
It's enough to do one single comparison to see if the string is empty or not.

source/blender/blenkernel/intern/constraint.c

index 569efd73fe0ee22532eed06281c36823b97391fa..7144e25ba7f4c4e31515fdbdf93dd952aef275cb 100644 (file)
@@ -538,7 +538,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
 static void constraint_target_to_mat4(Object *ob, const char *substring, float mat[4][4], short from, short to, float headtail)
 {
        /*      Case OBJECT */
-       if (!strlen(substring)) {
+       if (substring[0] == '\0') {
                copy_m4_m4(mat, ob->obmat);
                BKE_constraint_mat_convertspace(ob, NULL, mat, from, to, false);
        }