[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40771] trunk/blender/source/blender: - use BLI_findstring rather then while loop for listbase lookups
Campbell Barton
ideasman42 at gmail.com
Mon Oct 3 14:56:34 CEST 2011
Revision: 40771
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40771
Author: campbellbarton
Date: 2011-10-03 12:56:33 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
- use BLI_findstring rather then while loop for listbase lookups
- remove BLI_assert I recently added to RNA_property_pointer_type since its intentionally called with no type check.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
trunk/blender/source/blender/makesrna/intern/rna_access.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2011-10-03 11:04:05 UTC (rev 40770)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2011-10-03 12:56:33 UTC (rev 40771)
@@ -427,11 +427,11 @@
for(tile=lb->first; tile; tile=tile->next) {
/* find image based on name, pointer becomes invalid with global undo */
- if(ima && strcmp(tile->idname, ima->id.name)==0);
+ if(ima && strcmp(tile->idname, ima->id.name)==0) {
+ /* ima is valid */
+ }
else {
- for(ima=bmain->image.first; ima; ima=ima->id.next)
- if(strcmp(tile->idname, ima->id.name)==0)
- break;
+ ima= BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
}
ibuf= BKE_image_get_ibuf(ima, NULL);
@@ -442,13 +442,7 @@
full image user (which isn't so obvious, btw) try to find ImBuf with
matched file name in list of already loaded images */
- ibuf= ima->ibufs.first;
- while(ibuf) {
- if(strcmp(tile->ibufname, ibuf->name)==0)
- break;
-
- ibuf= ibuf->next;
- }
+ ibuf= BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name));
}
if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c 2011-10-03 11:04:05 UTC (rev 40770)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c 2011-10-03 12:56:33 UTC (rev 40771)
@@ -1095,9 +1095,7 @@
if(cprop->item_type)
return cprop->item_type;
}
- else {
- BLI_assert(0);
- }
+ /* ignore other types, RNA_struct_find_nested calls with unchecked props */
return &RNA_UnknownType;
}
More information about the Bf-blender-cvs
mailing list