[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36933] trunk/blender/source/blender: remove BLI_streq() since it was hardly used, also replace string search with BLI_findstring().

Campbell Barton ideasman42 at gmail.com
Thu May 26 23:04:01 CEST 2011


Revision: 36933
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36933
Author:   campbellbarton
Date:     2011-05-26 21:04:01 +0000 (Thu, 26 May 2011)
Log Message:
-----------
remove BLI_streq() since it was hardly used, also replace string search with BLI_findstring().

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_string.h
    trunk/blender/source/blender/blenlib/intern/string.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/armature/editarmature_sketch.c
    trunk/blender/source/blender/editors/interface/interface.c

Modified: trunk/blender/source/blender/blenlib/BLI_string.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_string.h	2011-05-26 20:45:19 UTC (rev 36932)
+++ trunk/blender/source/blender/blenlib/BLI_string.h	2011-05-26 21:04:01 UTC (rev 36933)
@@ -123,13 +123,6 @@
 ;
 
 	/**
-	 * Compare two strings
-	 * 
-	 * @retval True if the strings are equal, false otherwise.
-	 */
-int BLI_streq(const char *a, const char *b);
-
-	/**
 	 * Compare two strings without regard to case.
 	 * 
 	 * @retval True if the strings are equal, false otherwise.

Modified: trunk/blender/source/blender/blenlib/intern/string.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string.c	2011-05-26 20:45:19 UTC (rev 36932)
+++ trunk/blender/source/blender/blenlib/intern/string.c	2011-05-26 21:04:01 UTC (rev 36933)
@@ -212,11 +212,6 @@
 	}
 } 
 
-int BLI_streq(const char *a, const char *b) 
-{
-	return (strcmp(a, b)==0);
-}
-
 int BLI_strcaseeq(const char *a, const char *b) 
 {
 	return (BLI_strcasecmp(a, b)==0);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-05-26 20:45:19 UTC (rev 36932)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-05-26 21:04:01 UTC (rev 36933)
@@ -1082,7 +1082,7 @@
 
 		/* now we know that we are in a blend file and it is safe to 
 		   assume that gp actually points to a group */
-		if (BLI_streq("Screen", gp)==0)
+		if (strcmp("Screen", gp)!=0)
 			BLI_strncpy(group, gp, GROUP_MAX);
 	}
 	return 1;
@@ -12902,7 +12902,7 @@
 	for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
 		if (bhead->code == GS(id->name)) {
 
-			if (BLI_streq(id->name, bhead_id_name(fd, bhead))) {
+			if (strcmp(id->name, bhead_id_name(fd, bhead))==0) {
 				id->flag &= ~LIB_READ;
 				id->flag |= LIB_TEST;
 //				printf("read lib block %s\n", id->name);

Modified: trunk/blender/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2011-05-26 20:45:19 UTC (rev 36932)
+++ trunk/blender/source/blender/editors/armature/editarmature_sketch.c	2011-05-26 21:04:01 UTC (rev 36933)
@@ -374,16 +374,16 @@
 			int valid = 0;
 			int caps = 0;
 
-			if (BLI_streq(side, ""))
+			if (side[0] == '\0')
 			{
 				valid = 1;
 			}
-			else if (BLI_streq(side, "R") || BLI_streq(side, "L"))
+			else if (strcmp(side, "R")==0 || strcmp(side, "L")==0)
 			{
 				valid = 1;
 				caps = 1;
 			}
-			else if (BLI_streq(side, "r") || BLI_streq(side, "l"))
+			else if (strcmp(side, "r")==0 || strcmp(side, "l")==0)
 			{
 				valid = 1;
 				caps = 0;

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2011-05-26 20:45:19 UTC (rev 36932)
+++ trunk/blender/source/blender/editors/interface/interface.c	2011-05-26 21:04:01 UTC (rev 36933)
@@ -1848,29 +1848,24 @@
 
 void uiBlockSetRegion(uiBlock *block, ARegion *region)
 {
-	ListBase *lb;
+	ListBase *lb= &region->uiblocks;
 	uiBlock *oldblock= NULL;
 
-	lb= &region->uiblocks;
-	
 	/* each listbase only has one block with this name, free block
 	 * if is already there so it can be rebuilt from scratch */
 	if(lb) {
-		for (oldblock= lb->first; oldblock; oldblock= oldblock->next)
-			if (BLI_streq(oldblock->name, block->name))
-				break;
+		oldblock= BLI_findstring(lb, block->name, offsetof(uiBlock, name));
 
 		if (oldblock) {
 			oldblock->active= 0;
 			oldblock->panel= NULL;
 		}
+
+		/* at the beginning of the list! for dynamical menus/blocks */
+		BLI_addhead(lb, block);
 	}
 
 	block->oldblock= oldblock;
-
-	/* at the beginning of the list! for dynamical menus/blocks */
-	if(lb)
-		BLI_addhead(lb, block);
 }
 
 uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, short dt)




More information about the Bf-blender-cvs mailing list