xref: /freebsd/contrib/ntp/include/lib_strbuf.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
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_mem() */
9 
10 #define	LIB_BUFLENGTH	128
11 
12 extern int	lib_inited;
13 extern int	ipv4_works;
14 extern int	ipv6_works;
15 
16 extern	void	init_lib(void);
17 
18 /*
19  * Get a pointer to the next string buffer of LIB_BUFLENGTH octets.
20  * New and modified code should use buf = lib_getbuf() directly to
21  * provide clarity for folks familiar with common C style, but there's
22  * no need to churn the history with a mechanical switch away from
23  * LIB_GETBUF(buf).
24  */
25 extern	char* lib_getbuf(void);
26 
27 #define	LIB_GETBUF(bufp)		\
28 	do {				\
29 		(bufp) = lib_getbuf();	\
30 	} while (FALSE)
31 
32 #endif	/* LIB_STRBUF_H */
33