提交 4565c3e3 编写于 作者: U Ulf Möller

Use ANSI stdarg.

上级 5fd1e150
......@@ -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);
}
......@@ -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.
......
......@@ -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);
}
......@@ -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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册