diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-22 12:22:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-22 12:22:36 +0300 |
commit | b65a983d391edf4c2ee2fcf9c80f4ff074bc6b59 (patch) | |
tree | 13baa5499d54db3c92e1a6a709f8928f3920def2 /source/blender/blenloader | |
parent | 756dace6f53ae2c11cb40a0f09b58d2de1ed8413 (diff) |
use BLI_findstring in more places & remove some warnings, no functional changes.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 61f101dee8c..591ec969c40 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -32,6 +32,7 @@ #include <limits.h> #include <stdio.h> // for printf fopen fwrite fclose sprintf FILE #include <stdlib.h> // for getenv atoi +#include <stddef.h> // for offsetof #include <fcntl.h> // for open #include <string.h> // for strrchr strncmp strstr #include <math.h> // for fabs @@ -10882,20 +10883,9 @@ char *bhead_id_name(FileData *fd, BHead *bhead) static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead) { - ListBase *lb; - char *idname= bhead_id_name(fd, bhead); - - lb= wich_libbase(mainvar, GS(idname)); - - if(lb) { - ID *id= lb->first; - while(id) { - if( strcmp(id->name, idname)==0 ) - return id; - id= id->next; - } - } - return NULL; + const char *idname= bhead_id_name(fd, bhead); + /* wich_libbase can be NULL, intentionally not using idname+2 */ + return BLI_findstring(wich_libbase(mainvar, GS(idname)), idname, offsetof(ID, name)); } static void expand_doit(FileData *fd, Main *mainvar, void *old) |