diff options
author | Ulf Möller <ulf@openssl.org> | 1999-05-05 12:35:27 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 1999-05-05 12:35:27 +0000 |
commit | 4565c3e36f5d1b74a0bdad03aa5b8c63744340a2 (patch) | |
tree | f55007befc849420a37d05af1f8648201a3c2d74 | |
parent | 5fd1e150f7db742e64f23c4358deed4cd0863b69 (diff) | |
download | openssl-4565c3e36f5d1b74a0bdad03aa5b8c63744340a2.tar.gz |
Use ANSI stdarg.
-rw-r--r-- | crypto/bio/b_print.c | 17 | ||||
-rw-r--r-- | crypto/bio/bio.h | 22 | ||||
-rw-r--r-- | crypto/err/err.c | 12 | ||||
-rw-r--r-- | 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 <stdio.h> +#include <stdarg.h> #include "cryptlib.h" #include <openssl/bio.h> -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 <stdarg.h> -#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 <stdio.h> +#include <stdarg.h> #include <openssl/lhash.h> #include <openssl/crypto.h> #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<num; i++) { - VAR_ARG(args,char *,a); + a=va_arg(args, char*); /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */ 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 ); |