mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[option] union of const and non-const char * in option
This commit is contained in:
parent
6c83455ab7
commit
d124b9bff0
@ -232,7 +232,7 @@ get_opt_rec(struct option *tree, const char *name_)
|
|||||||
mem_free(aname);
|
mem_free(aname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
mem_free_set(&option->name, stracpy(name));
|
mem_free_set(&option->aname, stracpy(name));
|
||||||
|
|
||||||
add_opt_rec(tree, "", option);
|
add_opt_rec(tree, "", option);
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ done_option(struct option *option)
|
|||||||
done_listbox_item(&option_browser, option->box_item);
|
done_listbox_item(&option_browser, option->box_item);
|
||||||
|
|
||||||
if (option->flags & OPT_ALLOC) {
|
if (option->flags & OPT_ALLOC) {
|
||||||
mem_free_if(option->name);
|
mem_free_if(option->aname);
|
||||||
mem_free(option);
|
mem_free(option);
|
||||||
} else if (!option->capt) {
|
} else if (!option->capt) {
|
||||||
/* We are probably dealing with a built-in autocreated option
|
/* We are probably dealing with a built-in autocreated option
|
||||||
|
@ -193,7 +193,10 @@ typedef int (*change_hook_T)(struct session *session, struct option *current,
|
|||||||
struct option {
|
struct option {
|
||||||
OBJECT_HEAD(struct option);
|
OBJECT_HEAD(struct option);
|
||||||
|
|
||||||
char *name;
|
union {
|
||||||
|
const char *name;
|
||||||
|
char *aname;
|
||||||
|
};
|
||||||
option_flags_T flags;
|
option_flags_T flags;
|
||||||
enum option_type type;
|
enum option_type type;
|
||||||
long min, max;
|
long min, max;
|
||||||
@ -216,7 +219,7 @@ struct option {
|
|||||||
* with ::INIT_OPT_INT or a similar macro.
|
* with ::INIT_OPT_INT or a similar macro.
|
||||||
* @relates option */
|
* @relates option */
|
||||||
#define INIT_OPTION(name, flags, type, min, max, value, desc, capt) \
|
#define INIT_OPTION(name, flags, type, min, max, value, desc, capt) \
|
||||||
{ NULL_LIST_HEAD, INIT_OBJECT("option"), name, flags, type, min, max, { (LIST_OF(struct option) *) (value) }, desc, capt }
|
{ NULL_LIST_HEAD, INIT_OBJECT("option"), {name}, flags, type, min, max, { (LIST_OF(struct option) *) (value) }, desc, capt }
|
||||||
|
|
||||||
extern struct option *config_options;
|
extern struct option *config_options;
|
||||||
extern struct option *cmdline_options;
|
extern struct option *cmdline_options;
|
||||||
|
@ -159,8 +159,8 @@ menu_list_ext(struct terminal *term, void *fn_, void *xxx)
|
|||||||
if (!strcmp(opt->name, "_template_")) continue;
|
if (!strcmp(opt->name, "_template_")) continue;
|
||||||
|
|
||||||
if (!init_string(&translated)
|
if (!init_string(&translated)
|
||||||
|| !add_real_optname_to_string(&translated, opt->name,
|
|| !add_real_optname_to_string(&translated, opt->aname,
|
||||||
strlen(opt->name))) {
|
strlen(opt->aname))) {
|
||||||
done_string(&translated);
|
done_string(&translated);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user