mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-24 23:22:30 +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:
committed by
Carlos R. Mafra
parent
dae63b5e96
commit
2913ac0f09
@@ -380,11 +380,10 @@ void wAppIconMove(WAppIcon * aicon, int x, int y)
|
||||
static void updateDockNumbers(WScreen *scr)
|
||||
{
|
||||
int length;
|
||||
char *ws_numbers;
|
||||
char ws_numbers[20];
|
||||
WAppIcon *dicon = scr->dock->icon_array[0];
|
||||
|
||||
ws_numbers = wmalloc(20);
|
||||
snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace + 1, ((scr->current_workspace / 10) + 1));
|
||||
snprintf(ws_numbers, sizeof(ws_numbers), "%i [ %i ]", scr->current_workspace + 1, ((scr->current_workspace / 10) + 1));
|
||||
length = strlen(ws_numbers);
|
||||
|
||||
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50, WMFontHeight(scr->icon_title_font) + 1, False);
|
||||
@@ -394,8 +393,6 @@ static void updateDockNumbers(WScreen *scr)
|
||||
|
||||
WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->white,
|
||||
scr->icon_title_font, 3, 2, ws_numbers, length);
|
||||
|
||||
wfree(ws_numbers);
|
||||
}
|
||||
#endif /* WS_INDICATOR */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user