diff --git a/options.c b/options.c index 0cb90b0..da54e82 100644 --- a/options.c +++ b/options.c @@ -562,19 +562,19 @@ void toggle_option_values(const char *name, bool global, bool verbose, char **va { const struct option_description *desc = find_toggle_option(name, &global); int i, count = count_strings(values); - char *ptr = NULL; + char *ptr; if (!desc) return; + if (global) { + ptr = global_ptr(desc); + } else { + ptr = local_ptr(desc, &buffer->options); + } if (desc->type == OPT_STR) { char *value; - if (global) - ptr = global_ptr(desc); - else - ptr = local_ptr(desc, &buffer->options); - value = *(char **)ptr; for (i = 0; i < count; i++) { if (streq(values[i], value)) @@ -621,11 +621,6 @@ void toggle_option_values(const char *name, bool global, bool verbose, char **va break; } - if (global) - ptr = global_ptr(desc); - else - ptr = local_ptr(desc, &buffer->options); - value = *(int *)ptr; for (i = 0; i < count; i++) { if (value == ints[i])