140266059SGregory Neil Shapiro /* 2*5dd76dd0SGregory 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 * 9*5dd76dd0SGregory 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))) 3540266059SGregory Neil Shapiro # endif 3640266059SGregory Neil Shapiro 3740266059SGregory Neil Shapiro /* 3840266059SGregory Neil Shapiro ** The following macros are useless, but are provided for symmetry. 3940266059SGregory Neil Shapiro */ 4040266059SGregory Neil Shapiro 4140266059SGregory Neil Shapiro # define SM_VA_LOCAL_DECL va_list ap; 4240266059SGregory Neil Shapiro # define SM_VA_ARG(ap, type) va_arg(ap, type) 4340266059SGregory Neil Shapiro # define SM_VA_END(ap) va_end(ap) 4440266059SGregory Neil Shapiro 4540266059SGregory Neil Shapiro #endif /* ! SM_VARARGS_H */ 46