xref: /freebsd/contrib/ntp/include/ntp_string.h (revision e0c4386e)
1 /*
2  * Define string ops: strchr strrchr memcmp memmove memset
3  */
4 
5 #ifndef NTP_STRING_H
6 #define NTP_STRING_H
7 
8 #ifdef HAVE_MEMORY_H
9 # include <memory.h>
10 #endif
11 
12 #ifdef HAVE_STRING_H
13 # include <string.h>
14 #endif
15 
16 #ifdef HAVE_BSTRING_H
17 # include <bstring.h>
18 #endif
19 
20 #ifdef NTP_NEED_BOPS
21 
22 #ifdef HAVE_STRINGS_H
23 # include <strings.h>		/* bcmp, bcopy, bzero */
24 #endif
25 
26 void	ntp_memset	(char *, int, int);
27 
28 #define memcmp(a, b, c)		bcmp(a, b, (int)(c))
29 #define memmove(t, f, c)	bcopy(f, t, (int)(c))
30 #define memcpy(t, f, c)		bcopy(f, t, (int)(c))
31 #define memset(a, x, c)		if (0 == (x)) \
32 					bzero(a, (int)(c)); \
33 				else \
34 					ntp_memset((char *)(a), x, c)
35 #endif /*  NTP_NEED_BOPS */
36 
37 #endif	/* NTP_STRING_H */
38