remove BLI_streq() since it was hardly used, also replace string search with BLI_findstring().

This commit is contained in:
Campbell Barton 2011-05-26 21:04:01 +00:00
parent 06fea1a0ff
commit 78b8e4a437
5 changed files with 10 additions and 27 deletions

@ -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.
*

@ -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);

@ -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);

@ -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;

@ -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)