remove BLI_streq() since it was hardly used, also replace string search with BLI_find...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 26 May 2011 21:04:01 +0000 (21:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 26 May 2011 21:04:01 +0000 (21:04 +0000)
source/blender/blenlib/BLI_string.h
source/blender/blenlib/intern/string.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/interface/interface.c

index 69702f720264361f2237ea418bc45a4c0c12dade..408809661cfbaa91a38d1449f0ebee63f3a3d602 100644 (file)
@@ -122,13 +122,6 @@ __attribute__ ((format (printf, 1, 2)))
 #endif
 ;
 
-       /**
-        * 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.
         * 
index 11de8a3d45c0a9ab56b180a0eeb036ba08ee9285..8e0314ec17f52f6be388cef87f7bdecd0fa0746f 100644 (file)
@@ -212,11 +212,6 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText)
        }
 } 
 
-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);
index 03cd6e188c4dfddbd36068126d0726e531fcac02..5f984a9268dc916f2ba05e386191bfda44f59f5a 100644 (file)
@@ -1082,7 +1082,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 
                /* 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 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
        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);
index ccb9a45af3750a29a1221e77dc2f391731f02854..97f85b92b32261e81d1634ab42888f9e54eb83d5 100644 (file)
@@ -374,16 +374,16 @@ static void sk_autoname(bContext *C, ReebArc *arc)
                        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;
index e70b793cfb01e2510e441b84c8c1ad4d42c704d7..da479fe7ca306da70698c3498a62b56f8fde8128 100644 (file)
@@ -1848,29 +1848,24 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb)
 
 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)