[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43585] trunk/blender/source/blender/ editors/interface: style chang, made mainly because I wanted to be able to add breakpoints to MEM_freeN calls which were on the same line as the if 's.

Campbell Barton ideasman42 at gmail.com
Sat Jan 21 23:00:40 CET 2012


Revision: 43585
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43585
Author:   campbellbarton
Date:     2012-01-21 22:00:40 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
style chang, made mainly because I wanted to be able to add breakpoints to MEM_freeN calls which were on the same line as the if's.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/interface/interface_layout.c
    trunk/blender/source/blender/editors/interface/interface_panel.c
    trunk/blender/source/blender/editors/interface/interface_regions.c
    trunk/blender/source/blender/editors/interface/interface_templates.c
    trunk/blender/source/blender/editors/interface/view2d.c

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -1946,21 +1946,32 @@
 		WM_operator_properties_free(but->opptr);
 		MEM_freeN(but->opptr);
 	}
-	if(but->func_argN) MEM_freeN(but->func_argN);
+
+	if(but->func_argN) {
+		MEM_freeN(but->func_argN);
+	}
+
 	if(but->active) {
 		/* XXX solve later, buttons should be free-able without context ideally,
 		 * however they may have open tooltips or popup windows, which need to
 		 * be closed using a context pointer */
-		if(C) 
+		if (C) {
 			ui_button_active_free(C, but);
-		else
-			if(but->active) 
+		}
+		else {
+			if(but->active) {
 				MEM_freeN(but->active);
+			}
+		}
 	}
-	if(but->str && but->str != but->strdata) MEM_freeN(but->str);
+	if (but->str && but->str != but->strdata) {
+		MEM_freeN(but->str);
+	}
 	ui_free_link(but->link);
 
-	if((but->type == BUT_IMAGE) && but->poin) IMB_freeImBuf((struct ImBuf *)but->poin);
+	if ((but->type == BUT_IMAGE) && but->poin) {
+		IMB_freeImBuf((struct ImBuf *)but->poin);
+	}
 
 	MEM_freeN(but);
 }
@@ -1975,11 +1986,13 @@
 		ui_free_but(C, but);
 	}
 
-	if(block->unit)
+	if (block->unit) {
 		MEM_freeN(block->unit);
+	}
 
-	if(block->func_argN)
+	if (block->func_argN) {
 		MEM_freeN(block->func_argN);
+	}
 
 	CTX_store_free_list(&block->contexts);
 
@@ -2646,8 +2659,9 @@
 			str= BLI_dynstr_get_cstring(dynstr);
 			BLI_dynstr_free(dynstr);
 
-			if(free)
+			if (free) {
 				MEM_freeN(item);
+			}
 
 			freestr= 1;
 		}
@@ -2663,10 +2677,12 @@
 				}
 			}
 
-			if(!str)
-				str= RNA_property_ui_name(prop);
-			if(free)
+			if (!str) {
+				str = RNA_property_ui_name(prop);
+			}
+			if (free) {
 				MEM_freeN(item);
+			}
 		}
 		else {
 			str= RNA_property_ui_name(prop);
@@ -2746,9 +2762,10 @@
 		but->a1= ui_get_but_step_unit(but, but->a1);
 	}
 
-	if(freestr)
+	if (freestr) {
 		MEM_freeN((void *)str);
-	
+	}
+
 	return but;
 }
 
@@ -3360,8 +3377,9 @@
 
 void uiBlockSetNFunc(uiBlock *block, uiButHandleFunc func, void *argN, void *arg2)
 {
-	if(block->func_argN)
+	if (block->func_argN) {
 		MEM_freeN(block->func_argN);
+	}
 
 	block->funcN= func;
 	block->func_argN= argN;
@@ -3390,8 +3408,9 @@
 
 void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2)
 {
-	if(but->func_argN)
+	if (but->func_argN) {
 		MEM_freeN(but->func_argN);
+	}
 
 	but->funcN= funcN;
 	but->func_argN= argN;
@@ -3429,8 +3448,9 @@
 {
 	uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
 	but->block_create_func= func;
-	if(but->func_argN)
+	if (but->func_argN) {
 		MEM_freeN(but->func_argN);
+	}
 	but->func_argN= argN;
 	ui_check_but(but);
 	return but;

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -1701,8 +1701,9 @@
 			changed= 1;
 		}
 
-		if(pbuf)
+		if (pbuf) {
 			MEM_freeN(pbuf);
+		}
 	}
 	/* cut & copy */
 	else if (copy || cut) {

Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -665,7 +665,9 @@
 	for(; i>=0; i--){
 		MEM_freeN(dir[i].relname);
 		MEM_freeN(dir[i].path);
-		if (dir[i].string) MEM_freeN(dir[i].string);
+		if (dir[i].string) {
+			MEM_freeN(dir[i].string);
+		}
 	}
 	free(dir);
 	dir= NULL;

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -499,8 +499,9 @@
 	}
 	uiBlockSetCurLayout(block, layout);
 
-	if(free)
+	if (free) {
 		MEM_freeN(item);
+	}
 }
 
 /* callback for keymap item change button */
@@ -705,12 +706,15 @@
 
 		RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
 		if(RNA_enum_name(item, retval, &name)) {
-			if(free) MEM_freeN(item);
+			if (free) {
+				MEM_freeN(item);
+			}
 			return name;
 		}
 		
-		if(free)
+		if (free) {
 			MEM_freeN(item);
+		}
 	}
 
 	return "";
@@ -792,8 +796,9 @@
 			}
 		}
 
-		if(free)
+		if (free) {
 			MEM_freeN(item);
+		}
 	}
 }
 
@@ -845,13 +850,16 @@
 	if((prop= RNA_struct_find_property(&ptr, propname))) {
 		RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
 		if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
-			if(free) MEM_freeN(item);
+			if(free) {
+				MEM_freeN(item);
+			}
 			RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str);
 			return;
 		}
 
-		if(free)
+		if (free) {
 			MEM_freeN(item);
+		}
 	}
 	else {
 		RNA_warning("%s.%s not found", RNA_struct_identifier(ptr.type), propname);
@@ -1096,7 +1104,9 @@
 	RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
 
 	if(!RNA_enum_value_from_id(item, value, &ivalue)) {
-		if(free) MEM_freeN(item);
+		if (free) {
+			MEM_freeN(item);
+		}
 		ui_item_disabled(layout, propname);
 		RNA_warning("enum property value not found: %s", value);
 		return;
@@ -1109,8 +1119,9 @@
 		}
 	}
 
-	if(free)
+	if (free) {
 		MEM_freeN(item);
+	}
 }
 
 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname)
@@ -1160,8 +1171,9 @@
 			}
 		}
 
-		if(free)
+		if (free) {
 			MEM_freeN(item);
+		}
 	}
 }
 
@@ -2731,8 +2743,9 @@
 {
 	DynStr *ds= BLI_dynstr_new();
 
-	if(str)
+	if (str) {
 		MEM_freeN(str);
+	}
 
 	ui_intro_uiLayout(ds, layout);
 

Modified: trunk/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_panel.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_panel.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -772,8 +772,9 @@
 			ui_panel_copy_offset(pa, pa->paneltab);
 
 	/* free panelsort array */
-	for(ps= panelsort, a=0; a<tot; a++, ps++)
+	for (ps = panelsort, a = 0; a < tot; a++, ps++) {
 		MEM_freeN(ps->pa);
+	}
 	MEM_freeN(panelsort);
 	
 	return done;

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -138,8 +138,9 @@
 static void menudata_free(MenuData *md)
 {
 	MEM_freeN((void *)md->instr);
-	if (md->items)
+	if (md->items) {
 		MEM_freeN(md->items);
+	}
 	MEM_freeN(md);
 }
 
@@ -394,8 +395,9 @@
 				}
 			}
 
-			if(free)
+			if (free) {
 				MEM_freeN(item);
+			}
 		}
 	}
 	
@@ -982,8 +984,9 @@
 	int a;
 
 	/* free search data */
-	for(a=0; a<data->items.maxitem; a++)
+	for (a = 0; a < data->items.maxitem; a++) {
 		MEM_freeN(data->items.names[a]);
+	}
 	MEM_freeN(data->items.names);
 	MEM_freeN(data->items.pointers);
 	MEM_freeN(data->items.icons);
@@ -1182,8 +1185,9 @@
 			uiButSetFlag(but, UI_BUT_REDALERT);
 	}
 	
-	for(x1=0; x1<items->maxitem; x1++)
+	for (x1 = 0; x1 < items->maxitem; x1++) {
 		MEM_freeN(items->names[x1]);
+	}
 	MEM_freeN(items->names);
 	MEM_freeN(items);
 }

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -2267,8 +2267,9 @@
 		uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
 
 	/* free name */
-	if(namebuf)
+	if (namebuf) {
 		MEM_freeN(namebuf);
+	}
 }
 
 void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
@@ -2372,8 +2373,9 @@
 					icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
 					uiItemL(row, (name)? name: "", icon);
 
-					if(name)
+					if (name) {
 						MEM_freeN((void *)name);
+					}
 				}
 
 				i++;

Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c	2012-01-21 21:58:47 UTC (rev 43584)
+++ trunk/blender/source/blender/editors/interface/view2d.c	2012-01-21 22:00:40 UTC (rev 43585)
@@ -1339,8 +1339,9 @@
 void UI_view2d_grid_free(View2DGrid *grid)
 {
 	/* only free if there's a grid */
-	if (grid)
+	if (grid) {
 		MEM_freeN(grid);
+	}
 }
 
 /* *********************************************************************** */
@@ -1754,7 +1755,9 @@
 void UI_view2d_scrollers_free(View2DScrollers *scrollers)
 {
 	/* need to free grid as well... */
-	if (scrollers->grid) MEM_freeN(scrollers->grid);
+	if (scrollers->grid) {
+		MEM_freeN(scrollers->grid);
+	}
 	MEM_freeN(scrollers);
 }
 



More information about the Bf-blender-cvs mailing list