*/
#include <stdio.h>
-#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
if (*buffer == NULL) {
if (*maxlen == 0)
*maxlen = 1024;
- *buffer = Malloc(*maxlen);
+ *buffer = OPENSSL_malloc(*maxlen);
}
while (*currlen >= *maxlen) {
*maxlen += 1024;
- *buffer = Realloc(*buffer, *maxlen);
+ *buffer = OPENSSL_realloc(*buffer, *maxlen);
}
/* What to do if *buffer is NULL? */
assert(*buffer != NULL);
{
va_list args;
int ret;
+
+ va_start(args, format);
+
+ ret = BIO_vprintf(bio, format, args);
+
+ va_end(args);
+ return(ret);
+ }
+
+int BIO_vprintf (BIO *bio, const char *format, va_list args)
+ {
+ int ret;
size_t retlen;
#ifdef USE_ALLOCATING_PRINT
char *hugebuf;
#else
- MS_STATIC char hugebuf[1024*2]; /* 10k in one chunk is the limit */
+ MS_STATIC char hugebuf[1024*10];
#endif
- va_start(args, format);
-
#ifndef USE_ALLOCATING_PRINT
hugebuf[0]='\0';
dopr(hugebuf, sizeof(hugebuf), &retlen, format, args);
ret=BIO_write(bio, hugebuf, (int)retlen);
#ifdef USE_ALLOCATING_PRINT
- Free(hugebuf);
+ OPENSSL_free(hugebuf);
}
CRYPTO_pop_info();
#endif
- va_end(args);
return(ret);
}
int BIO_snprintf(char *buf, size_t n, const char *format, ...)
{
va_list args;
+ int ret;
+
+ va_start(args, format);
+
+ ret = BIO_vsnprintf(buf, n, format, args);
+
+ va_end(args);
+ return(ret);
+ }
+
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+ {
size_t retlen;
int truncated;
- va_start(args, format);
_dopr(dopr_outch, dopr_isbig, dopr_copy,
&buf, &n, &retlen, &truncated, format, args);
if (truncated)