mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
MIME: Re-arrange
Let get_mime_handler_name return an option instead of a name, and rename it to get_mime_handler_option.
This commit is contained in:
parent
e56f429c9b
commit
680a1c735b
@ -168,8 +168,8 @@ get_mime_type_name(unsigned char *type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned char *
|
static inline struct option *
|
||||||
get_mime_handler_name(unsigned char *type, int xwin)
|
get_mime_handler_option(unsigned char *type, int xwin)
|
||||||
{
|
{
|
||||||
struct option *opt;
|
struct option *opt;
|
||||||
unsigned char *name = get_mime_type_name(type);
|
unsigned char *name = get_mime_type_name(type);
|
||||||
@ -180,20 +180,20 @@ get_mime_handler_name(unsigned char *type, int xwin)
|
|||||||
mem_free(name);
|
mem_free(name);
|
||||||
if (!opt) return NULL;
|
if (!opt) return NULL;
|
||||||
|
|
||||||
return straconcat("mime.handler.", opt->value.string,
|
name = straconcat("mime.handler.", opt->value.string,
|
||||||
".", get_system_str(xwin), NULL);
|
".", get_system_str(xwin), NULL);
|
||||||
|
if (!name) return NULL;
|
||||||
|
|
||||||
|
opt = get_opt_rec_real(config_options, name);
|
||||||
|
mem_free(name);
|
||||||
|
|
||||||
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mime_handler *
|
static struct mime_handler *
|
||||||
get_mime_handler_default(unsigned char *type, int have_x)
|
get_mime_handler_default(unsigned char *type, int have_x)
|
||||||
{
|
{
|
||||||
struct option *opt_tree;
|
struct option *opt_tree = get_mime_handler_option(type, have_x);
|
||||||
unsigned char *handler_name = get_mime_handler_name(type, have_x);
|
|
||||||
|
|
||||||
if (!handler_name) return NULL;
|
|
||||||
|
|
||||||
opt_tree = get_opt_rec_real(config_options, handler_name);
|
|
||||||
mem_free(handler_name);
|
|
||||||
|
|
||||||
if (opt_tree) {
|
if (opt_tree) {
|
||||||
unsigned char *desc = "";
|
unsigned char *desc = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user