aboutsummaryrefslogtreecommitdiff
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-05-31 12:19:34 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-05-31 12:19:34 +0000
commita0cf65db77343cf60a72c59596ccfcaebe91c663 (patch)
tree6da84a69d197b39dc4c4669b467b47e8f1b770d4 /tmux.h
parent88a4da97478ec6b4b2f361315a5a183333d0aa3f (diff)
downloadrtmux-a0cf65db77343cf60a72c59596ccfcaebe91c663.tar.gz
rtmux-a0cf65db77343cf60a72c59596ccfcaebe91c663.tar.bz2
rtmux-a0cf65db77343cf60a72c59596ccfcaebe91c663.zip
Instead of eating 1024 bytes or so for the arguments of each command,
save memory by using an RB tree. From Tiago Cunha.
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/tmux.h b/tmux.h
index 7404b27f..7c577b4d 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1361,13 +1361,18 @@ struct client {
};
ARRAY_DECL(clients, struct client *);
-/* Parsed arguments. */
-struct args {
- bitstr_t *flags;
- char *values[SCHAR_MAX]; /* XXX This is awfully big. */
+/* Parsed arguments structures. */
+struct args_entry {
+ u_char flag;
+ char *value;
+ RB_ENTRY(args_entry) entry;
+};
+RB_HEAD(args_tree, args_entry);
- int argc;
- char **argv;
+struct args {
+ struct args_tree tree;
+ int argc;
+ char **argv;
};
/* Command and list of commands. */
@@ -1724,6 +1729,8 @@ extern const char clock_table[14][5][5];
void clock_draw(struct screen_write_ctx *, int, int);
/* arguments.c */
+int args_cmp(struct args_entry *, struct args_entry *);
+RB_PROTOTYPE(args_tree, args_entry, entry, args_cmp);
struct args *args_create(int, ...);
struct args *args_parse(const char *, int, char **);
void args_free(struct args *);