From 4565c3e36f5d1b74a0bdad03aa5b8c63744340a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Wed, 5 May 1999 12:35:27 +0000 Subject: [PATCH] Use ANSI stdarg. --- crypto/bio/b_print.c | 17 ++++++----------- crypto/bio/bio.h | 22 +--------------------- crypto/err/err.c | 12 ++++++------ crypto/err/err.h | 2 +- 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c index 5fb89d4c2c..f448004298 100644 --- a/crypto/bio/b_print.c +++ b/crypto/bio/b_print.c @@ -61,32 +61,27 @@ */ #include +#include #include "cryptlib.h" #include -int BIO_printf ( VAR_PLIST( BIO *, bio ) ) -VAR_ALIST +int BIO_printf (BIO *bio, ...) { - VAR_BDEFN(args, BIO *, bio); + va_list args; char *format; int ret; MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */ - VAR_INIT(args, BIO *, bio); - VAR_ARG(args, char *, format); + va_start(args, bio); + format=va_arg(args, char *); hugebuf[0]='\0'; -/* no-one uses _doprnt anymore and it appears to be broken under SunOS 4.1.4 */ -#if 0 && defined(sun) && !defined(VAR_ANSI) /**/ - _doprnt(hugebuf,format,args); -#else /* !sun */ vsprintf(hugebuf,format,args); -#endif /* sun */ ret=BIO_write(bio,hugebuf,strlen(hugebuf)); - VAR_END( args ); + va_end(args); return(ret); } diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index 0915c8885d..b2871c7235 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -532,28 +532,8 @@ void BIO_copy_next_retry(BIO *b); long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); -/* Tim Hudson's portable varargs stuff */ +int BIO_printf(BIO *bio, ...); -#define VAR_ANSI /* select ANSI version by default */ -#endif - -#ifdef VAR_ANSI -/* ANSI version of a "portable" macro set for variable length args */ -#ifndef __STDARG_H__ /**/ -#include -#endif /**/ - -#define VAR_PLIST(arg1type,arg1) arg1type arg1, ... -#define VAR_PLIST2(arg1type,arg1,arg2type,arg2) arg1type arg1,arg2type arg2,... -#define VAR_ALIST -#define VAR_BDEFN(args,arg1type,arg1) va_list args -#define VAR_BDEFN2(args,arg1type,arg1,arg2type,arg2) va_list args -#define VAR_INIT(args,arg1type,arg1) va_start(args,arg1); -#define VAR_INIT2(args,arg1type,arg1,arg2type,arg2) va_start(args,arg2); -#define VAR_ARG(args,type,arg) arg=va_arg(args,type) -#define VAR_END(args) va_end(args); - -int BIO_printf( VAR_PLIST( BIO *, bio ) ); /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. diff --git a/crypto/err/err.c b/crypto/err/err.c index 34320b375a..47bc5fa6a1 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -57,6 +57,7 @@ */ #include +#include #include #include #include "cryptlib.h" @@ -580,10 +581,9 @@ void ERR_set_error_data(char *data, int flags) es->err_data_flags[es->top]=flags; } -void ERR_add_error_data( VAR_PLIST(int , num)) -VAR_ALIST +void ERR_add_error_data(int num, ...) { - VAR_BDEFN(args, int, num); + va_list args; int i,n,s; char *str,*p,*a; @@ -592,11 +592,11 @@ VAR_ALIST if (str == NULL) return; str[0]='\0'; - VAR_INIT(args,int,num); + va_start(args, num); n=0; for (i=0; i */ if (a != NULL) { @@ -618,6 +618,6 @@ VAR_ALIST } ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); - VAR_END( args ); + va_end(args); } diff --git a/crypto/err/err.h b/crypto/err/err.h index c7b3921037..0ef83d5ead 100644 --- a/crypto/err/err.h +++ b/crypto/err/err.h @@ -235,7 +235,7 @@ void ERR_print_errors_fp(FILE *fp); #endif #ifdef HEADER_BIO_H void ERR_print_errors(BIO *bp); -void ERR_add_error_data( VAR_PLIST( int, num ) ); +void ERR_add_error_data(int num, ...); #endif void ERR_load_strings(int lib,ERR_STRING_DATA str[]); void ERR_load_ERR_strings(void ); -- 2.25.1