diff options
Diffstat (limited to 'source/blender/blenlib/intern/listbase.c')
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 6626896d266..5c43c2440aa 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -363,6 +363,27 @@ void *BLI_findstring(ListBase *listbase, const char *id, int offset) return NULL; } +int BLI_findstringindex(ListBase *listbase, const char *id, int offset) +{ + Link *link= NULL; + const char *id_iter; + int i= 0; + + if (listbase == NULL) return -1; + + link= listbase->first; + while (link) { + id_iter= ((const char *)link) + offset; + + if(id[0] == id_iter[0] && strcmp(id, id_iter)==0) + return i; + i++; + link= link->next; + } + + return -1; +} + void BLI_duplicatelist(ListBase *list1, const ListBase *list2) { struct Link *link1, *link2; |