summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-05-31 12:19:35 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-05-31 12:19:35 +0000
commit2e512bbb2825100f8e7b91c41e115d7de61cf6d4 (patch)
treee997436200338d45edaf015fa6428ab8bf807a20 /usr.bin/tmux/tmux.h
parentb6b06d9f4c41bd84aabe1f2849ea6e5e789ecf51 (diff)
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 'usr.bin/tmux/tmux.h')
-rw-r--r--usr.bin/tmux/tmux.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index cc3c6e149da..2679108a750 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.409 2013/04/24 10:01:32 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.410 2013/05/31 12:19:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 *);