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/shader_fx | |
parent | 3f7b585a083573ef5e94784ba5d3d4f4c7b97255 (diff) |
Cleanup: Do not pass stack allocated string to MEM_callocN
Diffstat (limited to 'source/blender/shader_fx')
-rw-r--r-- | source/blender/shader_fx/intern/FX_ui_common.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/source/blender/shader_fx/intern/FX_ui_common.c b/source/blender/shader_fx/intern/FX_ui_common.c index 9a86e1e96f5..8a259c6aaff 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.c +++ b/source/blender/shader_fx/intern/FX_ui_common.c @@ -241,14 +241,9 @@ static bool shaderfx_ui_poll(const bContext *C, PanelType *UNUSED(pt)) */ PanelType *shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw) { + PanelType *panel_type = MEM_callocN(sizeof(PanelType), __func__); - /* Get the name for the effect's panel. */ - char panel_idname[BKE_ST_MAXNAME]; - BKE_shaderfxType_panel_id(type, panel_idname); - - PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname); - - BLI_strncpy(panel_type->idname, panel_idname, BKE_ST_MAXNAME); + BKE_shaderfxType_panel_id(type, panel_type->idname); BLI_strncpy(panel_type->label, "", BKE_ST_MAXNAME); BLI_strncpy(panel_type->context, "shaderfx", BKE_ST_MAXNAME); BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); @@ -282,13 +277,9 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type, PanelDrawFn draw, 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->context, "shaderfx", BKE_ST_MAXNAME); BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME); |