diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-21 07:00:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-21 07:00:10 +0000 |
commit | bbc2bb8fcbd05be09c44c833dc486fea07cc8450 (patch) | |
tree | 3bdebf85fe10eec75efea8823d55a67269d90612 | |
parent | c3047b68979eabf890fad2418b690db5736b95bc (diff) |
Drop tiny union from option struct.
-rw-r--r-- | usr.bin/tmux/options.c | 18 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 9 |
2 files changed, 13 insertions, 14 deletions
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c index 6b9f9698139..b037a49befc 100644 --- a/usr.bin/tmux/options.c +++ b/usr.bin/tmux/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.2 2009/07/21 19:54:22 nicm Exp $ */ +/* $OpenBSD: options.c,v 1.3 2009/09/21 07:00:09 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 46899bbf1c4..03bfd32dc6b 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.108 2009/09/21 06:55:06 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.109 2009/09/21 07:00:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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; }; |