Use ANSI stdarg.
authorUlf Möller <ulf@openssl.org>
Wed, 5 May 1999 12:35:27 +0000 (12:35 +0000)
committerUlf Möller <ulf@openssl.org>
Wed, 5 May 1999 12:35:27 +0000 (12:35 +0000)
crypto/bio/b_print.c
crypto/bio/bio.h
crypto/err/err.c
crypto/err/err.h

index 5fb89d4c2c6bf8b4120229cfd31e6cab48edb7e8..f448004298afba947f0256062264b4485b3415d8 100644 (file)
  */
 
 #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);
        }
 
index 0915c8885d57c09d6d4ce56d1e8740ab6eba8429..b2871c7235c912e995926cab0f5a58c312c76b77 100644 (file)
@@ -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.
index 34320b375a92ba7facf86e5db6af2865ab93ac4a..47bc5fa6a1003e8514950fbd6e28e7513772305e 100644 (file)
@@ -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);
        }
 
index c7b3921037e8ed6be0f4af839adf79b23ba27006..0ef83d5ead95390b397eb3a4319d82684804e82f 100644 (file)
@@ -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 );