lib_strbuf.h revision 290001
1/*
2 * lib_strbuf.h - definitions for routines which use the common string buffers
3 */
4#ifndef LIB_STRBUF_H
5#define LIB_STRBUF_H
6
7#include <ntp_types.h>
8#include <ntp_malloc.h>			/* for ZERO() */
9
10/*
11 * Sizes of things
12 */
13#define LIB_NUMBUF	16
14#define	LIB_BUFLENGTH	128
15
16typedef char libbufstr[LIB_BUFLENGTH];
17extern libbufstr lib_stringbuf[LIB_NUMBUF];
18extern int lib_nextbuf;
19extern int lib_inited;
20
21
22/*
23 * Macro to get a pointer to the next buffer
24 */
25#define	LIB_GETBUF(bufp)					\
26	do {							\
27		ZERO(lib_stringbuf[lib_nextbuf]);		\
28		(bufp) = &lib_stringbuf[lib_nextbuf++][0];	\
29		lib_nextbuf %= COUNTOF(lib_stringbuf);		\
30	} while (FALSE)
31
32#endif	/* LIB_STRBUF_H */
33