[Bf-blender-cvs] [e343e4a] master: Avoid per-constraint-target call of strlen

Sergey Sharybin noreply at git.blender.org
Tue May 10 17:17:02 CEST 2016


Commit: e343e4a5baf0d608b81093debbdb9f8ca835bb18
Author: Sergey Sharybin
Date:   Tue May 10 17:15:16 2016 +0200
Branches: master
https://developer.blender.org/rBe343e4a5baf0d608b81093debbdb9f8ca835bb18

Avoid per-constraint-target call of strlen

It's enough to do one single comparison to see if the string is empty or not.

===================================================================

M	source/blender/blenkernel/intern/constraint.c

===================================================================

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 569efd7..7144e25 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -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);
 	}




More information about the Bf-blender-cvs mailing list