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