diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-09 21:31:51 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-09 21:31:51 +0300 |
commit | 996586860b0e2c86e515df1e38316afda32df4a0 (patch) | |
tree | bec14c8b266196a22ed87c8dcb3edfe4c0bc549b /source/blender/editors/animation | |
parent | 3f7b585a083573ef5e94784ba5d3d4f4c7b97255 (diff) |
Cleanup: Do not pass stack allocated string to MEM_callocN
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/fmodifier_ui.c | 18 |
1 files changed, 5 insertions, 13 deletions
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); |