freebsd-nq/include/lib_strbuf.h
Cy Schubert b5e14a1344 Vendor import ntp 4.2.8.
Reviewed by:	roberto
Security:	VUXML: 4033d826-87dd-11e4-9079-3c970e169bc2
Security:	http://www.kb.cert.org/vuls/id/852879
Security:	CVE-2014-9293
Security	CVE-2014-9294
Security	CVE-2014-9295
Security	CVE-2014-9296
2014-12-20 22:52:39 +00:00

33 lines
674 B
C

/*
* 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 */