1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 21:34:17 +01:00

Do not allocate memory for a temporary buffer

This kind of things participates in memory fragmentation, so it is
generally a bad practice when an on-stack allocation is enough.
Took opportunity to reduce the buffer size, there's no point in
overallocating memory (the new size being still way too much).

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2019-02-22 17:03:49 +01:00
committed by Carlos R. Mafra
parent dae63b5e96
commit 2913ac0f09
2 changed files with 5 additions and 8 deletions

View File

@@ -1436,12 +1436,12 @@ static WEditMenu *buildSubmenu(_Panel * panel, WMPropList * pl)
WSetEditMenuItemImage(item, panel->markerPix[data->type]);
WSetEditMenuItemData(item, data, (WMCallback *) freeItemData);
} else {
char *buf = wmalloc(1024);
snprintf(buf, 1024, _("Invalid menu command \"%s\" with label \"%s\" cleared"),
char buf[256];
snprintf(buf, sizeof(buf), _("Invalid menu command \"%s\" with label \"%s\" cleared"),
WMGetFromPLString(WMGetFromPLArray(pi, 1)),
WMGetFromPLString(WMGetFromPLArray(pi, 0)));
WMRunAlertPanel(scr, panel->parent, _("Warning"), buf, _("OK"), NULL, NULL);
wfree(buf);
}
}