More optimal menu free code -miguel
Этот коммит содержится в:
родитель
26eca16176
Коммит
549908db83
@ -54,6 +54,8 @@ Menu create_menu (char *name, menu_entry *entries, int count)
|
||||
register char* cp;
|
||||
for (mp = entries; count--; mp++)
|
||||
{
|
||||
mp->string_dupped = 0;
|
||||
|
||||
if (mp->text[0] == '\0')
|
||||
continue;
|
||||
|
||||
@ -76,8 +78,8 @@ Menu create_menu (char *name, menu_entry *entries, int count)
|
||||
}
|
||||
*dest = '\0';
|
||||
mp->text = strdup(tmpbuf);
|
||||
} else
|
||||
mp->text = strdup (mp->text);
|
||||
mp->string_dupped = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
menu->name = _(name);
|
||||
@ -531,7 +533,7 @@ destroy_menu (Menu menu)
|
||||
for (i = 0, e = menu->entries; i < menu->count; i++){
|
||||
#ifdef ENABLE_NLS
|
||||
/* Separators are NULLS */
|
||||
if (*e->text)
|
||||
if (e->string_dupped)
|
||||
free (e->text);
|
||||
#endif
|
||||
e++;
|
||||
|
@ -20,6 +20,7 @@ typedef struct {
|
||||
int hot_key;
|
||||
int hot_pos;
|
||||
callfn call_back;
|
||||
int string_dupped;
|
||||
} menu_entry;
|
||||
|
||||
#ifdef HAVE_XVIEW
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user