[Bf-blender-cvs] [7891899] master: Replace inefficient use of strstr with STRPREFIX macro

Campbell Barton noreply at git.blender.org
Sat May 10 01:30:13 CEST 2014


Commit: 78918995a45a3dd54ec075b2f7ae0332a08837d4
Author: Campbell Barton
Date:   Sat May 10 09:27:44 2014 +1000
https://developer.blender.org/rB78918995a45a3dd54ec075b2f7ae0332a08837d4

Replace inefficient use of strstr with STRPREFIX macro

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

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

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

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index ee52489..6a9c4c8 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -386,10 +386,10 @@ void BKE_relink_animdata(AnimData *adt)
  * < basepath: (str) shorter path fragment to look for
  * > returns (bool) whether there is a match
  */
-static short animpath_matches_basepath(const char path[], const char basepath[])
+static bool animpath_matches_basepath(const char path[], const char basepath[])
 {
 	/* we need start of path to be basepath */
-	return (path && basepath) && (strstr(path, basepath) == path);
+	return (path && basepath) && STRPREFIX(path, basepath);
 }
 
 /* Move F-Curves in src action to dst action, setting up all the necessary groups




More information about the Bf-blender-cvs mailing list