aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-09-21 07:00:09 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-09-21 07:00:09 +0000
commitfc9107a16aa9a8674c7b049ecc68ea25bb026df6 (patch)
treeccfad762d805acb1255189573e765abeddd4495f
parentc7a8db55438deae5214956cbba42a3833c8ec0c9 (diff)
downloadrtmux-fc9107a16aa9a8674c7b049ecc68ea25bb026df6.tar.gz
rtmux-fc9107a16aa9a8674c7b049ecc68ea25bb026df6.tar.bz2
rtmux-fc9107a16aa9a8674c7b049ecc68ea25bb026df6.zip
Drop tiny union from option struct.
-rw-r--r--options.c16
-rw-r--r--tmux.h7
2 files changed, 11 insertions, 12 deletions
diff --git a/options.c b/options.c
index 45d9f714..90d9c88e 100644
--- a/options.c
+++ b/options.c
@@ -53,7 +53,7 @@ options_free(struct options *oo)
SPLAY_REMOVE(options_tree, &oo->tree, o);
xfree(o->name);
if (o->type == OPTIONS_STRING)
- xfree(o->value.string);
+ xfree(o->str);
xfree(o);
}
}
@@ -94,7 +94,7 @@ options_remove(struct options *oo, const char *name)
SPLAY_REMOVE(options_tree, &oo->tree, o);
xfree(o->name);
if (o->type == OPTIONS_STRING)
- xfree(o->value.string);
+ xfree(o->str);
xfree(o);
}
@@ -109,11 +109,11 @@ options_set_string(struct options *oo, const char *name, const char *fmt, ...)
o->name = xstrdup(name);
SPLAY_INSERT(options_tree, &oo->tree, o);
} else if (o->type == OPTIONS_STRING)
- xfree(o->value.string);
+ xfree(o->str);
va_start(ap, fmt);
o->type = OPTIONS_STRING;
- xvasprintf(&o->value.string, fmt, ap);
+ xvasprintf(&o->str, fmt, ap);
va_end(ap);
}
@@ -126,7 +126,7 @@ options_get_string(struct options *oo, const char *name)
fatalx("missing option");
if (o->type != OPTIONS_STRING)
fatalx("option not a string");
- return (o->value.string);
+ return (o->str);
}
void
@@ -139,10 +139,10 @@ options_set_number(struct options *oo, const char *name, long long value)
o->name = xstrdup(name);
SPLAY_INSERT(options_tree, &oo->tree, o);
} else if (o->type == OPTIONS_STRING)
- xfree(o->value.string);
+ xfree(o->str);
o->type = OPTIONS_NUMBER;
- o->value.number = value;
+ o->num = value;
}
@@ -155,5 +155,5 @@ options_get_number(struct options *oo, const char *name)
fatalx("missing option");
if (o->type != OPTIONS_NUMBER)
fatalx("option not a number");
- return (o->value.number);
+ return (o->num);
}
diff --git a/tmux.h b/tmux.h
index b69621d6..64409ae8 100644
--- a/tmux.h
+++ b/tmux.h
@@ -545,10 +545,9 @@ struct options_entry {
OPTIONS_STRING,
OPTIONS_NUMBER,
} type;
- union {
- char *string;
- long long number;
- } value;
+
+ char *str;
+ long long num;
SPLAY_ENTRY(options_entry) entry;
};