diff options
author | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-07-15 19:21:26 +0000 |
commit | 2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch) | |
tree | b0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/include/lib_strbuf.h | |
parent | a0741a75537b2e0514472ac3b28afc55a7846c30 (diff) | |
download | FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.zip FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.tar.gz |
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
284864,285169-285170,285435:
ntp 4.2.8p3.
Relnotes: yes
Approved by: re (?)
Diffstat (limited to 'contrib/ntp/include/lib_strbuf.h')
-rw-r--r-- | contrib/ntp/include/lib_strbuf.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/ntp/include/lib_strbuf.h b/contrib/ntp/include/lib_strbuf.h new file mode 100644 index 0000000..5ee92d6 --- /dev/null +++ b/contrib/ntp/include/lib_strbuf.h @@ -0,0 +1,32 @@ +/* + * lib_strbuf.h - definitions for routines which use the common string buffers + */ +#ifndef LIB_STRBUF_H +#define LIB_STRBUF_H + +#include <ntp_types.h> +#include <ntp_malloc.h> /* for ZERO() */ + +/* + * Sizes of things + */ +#define LIB_NUMBUF 16 +#define LIB_BUFLENGTH 128 + +typedef char libbufstr[LIB_BUFLENGTH]; +extern libbufstr lib_stringbuf[LIB_NUMBUF]; +extern int lib_nextbuf; +extern int lib_inited; + + +/* + * Macro to get a pointer to the next buffer + */ +#define LIB_GETBUF(bufp) \ + do { \ + ZERO(lib_stringbuf[lib_nextbuf]); \ + (bufp) = &lib_stringbuf[lib_nextbuf++][0]; \ + lib_nextbuf %= COUNTOF(lib_stringbuf); \ + } while (FALSE) + +#endif /* LIB_STRBUF_H */ |