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