diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-07 22:52:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-07 22:52:33 +0000 |
commit | 4846ad16579f7fcf06fe01e03a56815b2d8c4a93 (patch) | |
tree | e5266f60bcd3e2fbdb203a10b26c67970ddc45a8 /client-msg.c | |
parent | 4924d8e1e2c367b9593a6972e1bcb65ab0cb0a93 (diff) | |
download | rtmux-4846ad16579f7fcf06fe01e03a56815b2d8c4a93.tar.gz rtmux-4846ad16579f7fcf06fe01e03a56815b2d8c4a93.tar.bz2 rtmux-4846ad16579f7fcf06fe01e03a56815b2d8c4a93.zip |
Introduce nitems() and use it; use bsearch.
Diffstat (limited to 'client-msg.c')
-rw-r--r-- | client-msg.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/client-msg.c b/client-msg.c index 65287f50..c1e28ecb 100644 --- a/client-msg.c +++ b/client-msg.c @@ -1,4 +1,4 @@ -/* $Id: client-msg.c,v 1.14 2007-12-06 09:46:21 nicm Exp $ */ +/* $Id: client-msg.c,v 1.15 2009-01-07 22:52:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -43,7 +43,6 @@ struct client_msg client_msg_table[] = { { MSG_EXIT, client_msg_fn_exit }, { MSG_EXITED, client_msg_fn_exited } }; -#define NCLIENTMSG (sizeof client_msg_table / sizeof client_msg_table[0]) int client_msg_dispatch(struct client_ctx *cctx, char **error) @@ -59,7 +58,7 @@ client_msg_dispatch(struct client_ctx *cctx, char **error) return (1); buffer_remove(cctx->srv_in, sizeof hdr); - for (i = 0; i < NCLIENTMSG; i++) { + for (i = 0; i < nitems(client_msg_table); i++) { msg = client_msg_table + i; if (msg->type == hdr.type) { if (msg->fn(&hdr, cctx, error) != 0) |