From ab7ebf2b10f67b002447fb0e2cb352c2c178e128 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 18 Oct 2017 15:07:26 +1100 Subject: Cleanup: Use const for RNA EnumPropertyItem args Practically all access to enum data is read-only. --- source/blender/editors/interface/interface.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source/blender/editors/interface/interface.c') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 30e47bc3d9e..dc4c1b71066 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3290,7 +3290,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu uiBut *but = (uiBut *)but_p; /* see comment in ui_item_enum_expand, re: uiname */ - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; bool free; uiLayout *split, *column = NULL; @@ -3400,9 +3400,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu UI_block_layout_set_current(block, layout); if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } - BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0); block->flag |= UI_BLOCK_IS_FLIP; } @@ -3433,7 +3432,7 @@ static uiBut *ui_def_but_rna( /* use rna values if parameters are not specified */ if ((proptype == PROP_ENUM) && ELEM(type, UI_BTYPE_MENU, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) { /* UI_BTYPE_MENU is handled a little differently here */ - EnumPropertyItem *item; + const EnumPropertyItem *item; int value; bool free; int i; @@ -3475,7 +3474,7 @@ static uiBut *ui_def_but_rna( } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } else { @@ -4437,7 +4436,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c } else { PointerRNA *ptr = UI_but_operator_ptr_get(but); /* Will create it if needed! */ - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; bool do_free; RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free); @@ -4450,8 +4449,9 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c } } - if (do_free) - MEM_freeN(item_array); + if (do_free) { + MEM_freeN((void *)item_array); + } } } @@ -4525,7 +4525,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) va_list args; uiStringInfo *si; - EnumPropertyItem *items = NULL, *item = NULL; + const EnumPropertyItem *items = NULL, *item = NULL; int totitems; bool free_items = false; @@ -4701,8 +4701,9 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) } va_end(args); - if (free_items && items) - MEM_freeN(items); + if (free_items && items) { + MEM_freeN((void *)items); + } } /* Program Init/Exit */ -- cgit v1.2.3