140266059SGregory Neil Shapiro /* 25dd76dd0SGregory Neil Shapiro * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers. 340266059SGregory Neil Shapiro * All rights reserved. 440266059SGregory Neil Shapiro * 540266059SGregory Neil Shapiro * By using this file, you agree to the terms and conditions set 640266059SGregory Neil Shapiro * forth in the LICENSE file which can be found at the top level of 740266059SGregory Neil Shapiro * the sendmail distribution. 840266059SGregory Neil Shapiro * 94313cc83SGregory Neil Shapiro * $Id: varargs.h,v 1.9 2013-11-22 20:51:32 ca Exp $ 1040266059SGregory Neil Shapiro */ 1140266059SGregory Neil Shapiro 1240266059SGregory Neil Shapiro /* 1340266059SGregory Neil Shapiro ** libsm variable argument lists 1440266059SGregory Neil Shapiro */ 1540266059SGregory Neil Shapiro 1640266059SGregory Neil Shapiro #ifndef SM_VARARGS_H 1740266059SGregory Neil Shapiro # define SM_VARARGS_H 1840266059SGregory Neil Shapiro 1940266059SGregory Neil Shapiro # if defined(__STDC__) || defined(__cplusplus) 2040266059SGregory Neil Shapiro # define SM_VA_STD 1 2140266059SGregory Neil Shapiro # include <stdarg.h> 2240266059SGregory Neil Shapiro # define SM_VA_START(ap, f) va_start(ap, f) 2340266059SGregory Neil Shapiro # else /* defined(__STDC__) || defined(__cplusplus) */ 2440266059SGregory Neil Shapiro # define SM_VA_STD 0 2540266059SGregory Neil Shapiro # include <varargs.h> 2640266059SGregory Neil Shapiro # define SM_VA_START(ap, f) va_start(ap) 2740266059SGregory Neil Shapiro # endif /* defined(__STDC__) || defined(__cplusplus) */ 2840266059SGregory Neil Shapiro 2940266059SGregory Neil Shapiro # if defined(va_copy) 3040266059SGregory Neil Shapiro # define SM_VA_COPY(dst, src) va_copy((dst), (src)) 3140266059SGregory Neil Shapiro # elif defined(__va_copy) 3240266059SGregory Neil Shapiro # define SM_VA_COPY(dst, src) __va_copy((dst), (src)) 3340266059SGregory Neil Shapiro # else 34959366dcSGregory Neil Shapiro # define SM_VA_COPY(dst, src) memcpy(&(dst), &(src), sizeof((dst))) 35*5b0945b5SGregory Neil Shapiro # define SM_VA_END_COPY(ap) do { } while (0) 36*5b0945b5SGregory Neil Shapiro # endif 37*5b0945b5SGregory Neil Shapiro 38*5b0945b5SGregory Neil Shapiro # ifndef SM_VA_END_COPY 39*5b0945b5SGregory Neil Shapiro # define SM_VA_END_COPY(ap) va_end(ap) 4040266059SGregory Neil Shapiro # endif 4140266059SGregory Neil Shapiro 4240266059SGregory Neil Shapiro /* 4340266059SGregory Neil Shapiro ** The following macros are useless, but are provided for symmetry. 4440266059SGregory Neil Shapiro */ 4540266059SGregory Neil Shapiro 4640266059SGregory Neil Shapiro # define SM_VA_LOCAL_DECL va_list ap; 4740266059SGregory Neil Shapiro # define SM_VA_ARG(ap, type) va_arg(ap, type) 4840266059SGregory Neil Shapiro # define SM_VA_END(ap) va_end(ap) 4940266059SGregory Neil Shapiro 5040266059SGregory Neil Shapiro #endif /* ! SM_VARARGS_H */ 51