Introduce nitems() and use it; use bsearch.

This commit is contained in:
Nicholas Marriott
2009-01-07 22:52:33 +00:00
parent 4924d8e1e2
commit 4846ad1657
9 changed files with 73 additions and 65 deletions

5
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.208 2009-01-07 19:53:17 nicm Exp $ */
/* $Id: tmux.h,v 1.209 2009-01-07 22:52:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -135,6 +135,9 @@ extern const char *__progname;
#define printflike3 __attribute__ ((format (printf, 3, 4)))
#define printflike4 __attribute__ ((format (printf, 4, 5)))
/* Number of items in array. */
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
/* Buffer macros. */
#define BUFFER_USED(b) ((b)->size)
#define BUFFER_FREE(b) ((b)->space - (b)->off - (b)->size)