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