xref: /freebsd/contrib/sendmail/include/sm/varargs.h (revision 19fae0f66023a97a9b464b3beeeabb2081f575b3)
1 /*
2  * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *	$Id: varargs.h,v 1.9 2013-11-22 20:51:32 ca Exp $
10  */
11 
12 /*
13 **  libsm variable argument lists
14 */
15 
16 #ifndef SM_VARARGS_H
17 # define SM_VARARGS_H
18 
19 # if defined(__STDC__) || defined(__cplusplus)
20 #  define SM_VA_STD 1
21 #  include <stdarg.h>
22 #  define SM_VA_START(ap, f)	va_start(ap, f)
23 # else /* defined(__STDC__) || defined(__cplusplus) */
24 #  define SM_VA_STD 0
25 #  include <varargs.h>
26 #  define SM_VA_START(ap, f)	va_start(ap)
27 # endif /* defined(__STDC__) || defined(__cplusplus) */
28 
29 # if defined(va_copy)
30 #  define SM_VA_COPY(dst, src)	va_copy((dst), (src))
31 # elif defined(__va_copy)
32 #  define SM_VA_COPY(dst, src)	__va_copy((dst), (src))
33 # else
34 #  define SM_VA_COPY(dst, src)	memcpy(&(dst), &(src), sizeof((dst)))
35 #  define SM_VA_END_COPY(ap)	do { } while (0)
36 # endif
37 
38 # ifndef SM_VA_END_COPY
39 #  define SM_VA_END_COPY(ap)	va_end(ap)
40 # endif
41 
42 /*
43 **  The following macros are useless, but are provided for symmetry.
44 */
45 
46 # define SM_VA_LOCAL_DECL	va_list ap;
47 # define SM_VA_ARG(ap, type)	va_arg(ap, type)
48 # define SM_VA_END(ap)		va_end(ap)
49 
50 #endif /* ! SM_VARARGS_H */
51