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.
This commit is contained in:
@@ -1946,21 +1946,32 @@ static void ui_free_but(const bContext *C, uiBut *but)
|
||||
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 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
|
||||
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 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
||||
str= BLI_dynstr_get_cstring(dynstr);
|
||||
BLI_dynstr_free(dynstr);
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
|
||||
freestr= 1;
|
||||
}
|
||||
@@ -2663,10 +2677,12 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
|
||||
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 uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2
|
||||
|
||||
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 uiButSetFunc(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2)
|
||||
|
||||
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 *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -1701,8 +1701,9 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
|
||||
changed= 1;
|
||||
}
|
||||
|
||||
if(pbuf)
|
||||
if (pbuf) {
|
||||
MEM_freeN(pbuf);
|
||||
}
|
||||
}
|
||||
/* cut & copy */
|
||||
else if (copy || cut) {
|
||||
|
||||
@@ -665,7 +665,9 @@ static void init_iconfile_list(struct ListBase *list)
|
||||
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;
|
||||
|
||||
@@ -499,8 +499,9 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
|
||||
}
|
||||
uiBlockSetCurLayout(block, layout);
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
|
||||
/* callback for keymap item change button */
|
||||
@@ -705,12 +706,15 @@ static const char *ui_menu_enumpropname(uiLayout *layout, const char *opname, co
|
||||
|
||||
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 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
|
||||
}
|
||||
}
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -845,13 +850,16 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
|
||||
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 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
|
||||
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 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
|
||||
}
|
||||
}
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname)
|
||||
@@ -1160,8 +1171,9 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
|
||||
}
|
||||
}
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2731,8 +2743,9 @@ const char *uiLayoutIntrospect(uiLayout *layout)
|
||||
{
|
||||
DynStr *ds= BLI_dynstr_new();
|
||||
|
||||
if(str)
|
||||
if (str) {
|
||||
MEM_freeN(str);
|
||||
}
|
||||
|
||||
ui_intro_uiLayout(ds, layout);
|
||||
|
||||
|
||||
@@ -772,8 +772,9 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
|
||||
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;
|
||||
|
||||
@@ -138,8 +138,9 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico
|
||||
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 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
||||
}
|
||||
}
|
||||
|
||||
if(free)
|
||||
if (free) {
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,8 +984,9 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
|
||||
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 @@ void ui_but_search_test(uiBut *but)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -2267,8 +2267,9 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
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 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
|
||||
icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
|
||||
uiItemL(row, (name)? name: "", icon);
|
||||
|
||||
if(name)
|
||||
if (name) {
|
||||
MEM_freeN((void *)name);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
@@ -1339,8 +1339,9 @@ void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy)
|
||||
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_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user