From 996586860b0e2c86e515df1e38316afda32df4a0 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 9 Mar 2021 13:31:51 -0500 Subject: Cleanup: Do not pass stack allocated string to MEM_callocN --- source/blender/editors/animation/fmodifier_ui.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 1809daa3fcb..653bd72b364 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -173,15 +173,11 @@ static PanelType *fmodifier_panel_register(ARegionType *region_type, PanelTypePollFn poll, const char *id_prefix) { - /* Get the name for the modifier's panel. */ - char panel_idname[BKE_ST_MAXNAME]; - const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); - BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_PT_%s", id_prefix, fmi->name); - - PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); + PanelType *panel_type = MEM_callocN(sizeof(PanelType), __func__); /* Intentionally leave the label field blank. The header is filled with buttons. */ - BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME); + const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); + BLI_snprintf(panel_type->idname, BKE_ST_MAXNAME, "%s_PT_%s", id_prefix, fmi->name); BLI_strncpy(panel_type->category, "Modifiers", BKE_ST_MAXNAME); BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); @@ -215,13 +211,9 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type, PanelTypePollFn poll, PanelType *parent) { - /* Create the subpanel's ID name. */ - char panel_idname[BKE_ST_MAXNAME]; - BLI_snprintf(panel_idname, BKE_ST_MAXNAME, "%s_%s", parent->idname, name); - - PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); + PanelType *panel_type = MEM_callocN(sizeof(PanelType), __func__); - BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME); + BLI_snprintf(panel_type->idname, BKE_ST_MAXNAME, "%s_%s", parent->idname, name); BLI_strncpy(panel_type->label, label, BKE_ST_MAXNAME); BLI_strncpy(panel_type->category, "Modifiers", BKE_ST_MAXNAME); BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); -- cgit v1.2.3