[Bf-blender-cvs] [6a2d5eb] master: UI: avoid using AT define for malloc id's

Campbell Barton noreply at git.blender.org
Wed Dec 18 18:10:13 CET 2013


Commit: 6a2d5eb1ef3901e7023c810d720a7e10f5553fa1
Author: Campbell Barton
Date:   Thu Dec 19 03:08:48 2013 +1100
http://developer.blender.org/rB6a2d5eb1ef3901e7023c810d720a7e10f5553fa1

UI: avoid using AT define for malloc id's

They're very verbose and while useful for debugging leaks - a unique
string is normally enough to track down the problem.

===================================================================

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 5e90884..8a4f89a 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6934,7 +6934,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
 
 				if (dyn_data->items_filter_neworder || dyn_data->items_filter_flags) {
 					/* If we have a display order different from collection order, we have some work! */
-					int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), AT);
+					int *org_order = MEM_mallocN(dyn_data->items_shown * sizeof(int), __func__);
 					int *new_order = dyn_data->items_filter_neworder;
 					int i, org_idx = -1, len = dyn_data->items_len;
 					int current_idx = -1;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index cd31ff2..fe16794 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2525,12 +2525,12 @@ static void uilist_filter_items_default(struct uiList *ui_list, struct bContext
 		int order_idx = 0, i = 0;
 
 		if (order_by_name) {
-			names = MEM_callocN(sizeof(StringCmp) * len, AT);
+			names = MEM_callocN(sizeof(StringCmp) * len, "StringCmp");
 		}
 		if (filter_raw[0]) {
 			size_t idx = 0, slen = strlen(filter_raw);
 
-			dyn_data->items_filter_flags = MEM_callocN(sizeof(int) * len, AT);
+			dyn_data->items_filter_flags = MEM_callocN(sizeof(int) * len, "items_filter_flags");
 			dyn_data->items_shown = 0;
 
 			/* Implicitly add heading/trailing wildcards if needed. */
@@ -2538,7 +2538,7 @@ static void uilist_filter_items_default(struct uiList *ui_list, struct bContext
 				filter = filter_buff;
 			}
 			else {
-				filter = filter_dyn = MEM_mallocN((slen + 3) * sizeof(char), AT);
+				filter = filter_dyn = MEM_mallocN((slen + 3) * sizeof(char), "filter_dyn");
 			}
 			if (filter_raw[idx] != '*') {
 				filter[idx++] = '*';
@@ -2601,7 +2601,7 @@ static void uilist_filter_items_default(struct uiList *ui_list, struct bContext
 			 */
 			qsort(names, order_idx, sizeof(StringCmp), cmpstringp);
 
-			dyn_data->items_filter_neworder = MEM_mallocN(sizeof(int) * order_idx, AT);
+			dyn_data->items_filter_neworder = MEM_mallocN(sizeof(int) * order_idx, "items_filter_neworder");
 			for (new_idx = 0; new_idx < order_idx; new_idx++) {
 				dyn_data->items_filter_neworder[names[new_idx].org_idx] = new_idx;
 			}
@@ -2790,13 +2790,13 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
 	ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id));
 
 	if (!ui_list) {
-		ui_list = MEM_callocN(sizeof(uiList), AT);
+		ui_list = MEM_callocN(sizeof(uiList), "uiList");
 		BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id));
 		BLI_addtail(&ar->ui_lists, ui_list);
 	}
 
 	if (!ui_list->dyn_data) {
-		ui_list->dyn_data = MEM_callocN(sizeof(uiListDyn), AT);
+		ui_list->dyn_data = MEM_callocN(sizeof(uiListDyn), "uiList.dyn_data");
 	}
 	dyn_data = ui_list->dyn_data;
 
@@ -2836,7 +2836,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
 		items_shown = dyn_data->items_shown;
 		if (items_shown >= 0) {
 			bool activei_mapping_pending = true;
-			items_ptr = MEM_mallocN(sizeof(_uilist_item) * items_shown, AT);
+			items_ptr = MEM_mallocN(sizeof(_uilist_item) * items_shown, __func__);
 			//printf("%s: items shown: %d.\n", __func__, items_shown);
 			RNA_PROP_BEGIN (dataptr, itemptr, prop)
 			{




More information about the Bf-blender-cvs mailing list