Diff for /rpl/src/asprintf.c between versions 1.1 and 1.2

version 1.1, 2010/01/29 11:38:15 version 1.2, 2010/01/29 16:49:23
Line 20 Line 20
 */  */
   
   
 #include <stdio.h>  #include "rpl.h"
 #include <stdlib.h>  
 #include <stdarg.h>  #include <stdarg.h>
 #include <string.h>  
 #include <strings.h>  
   
 int  int
 vasprintf(char **strp, const char *fmt, va_list ap)  valsprintf(unsigned char **strp, const char *fmt, va_list ap)
 {  {
   size_t bs;    size_t            bs;
   size_t s;    size_t            s;
   char *b = NULL;    unsigned char     *b = NULL;
   
   for(bs = 1024;; bs *= 2)    for(bs = 1024;; bs *= 2)
   {    {
Line 57  vasprintf(char **strp, const char *fmt, Line 55  vasprintf(char **strp, const char *fmt,
     }      }
   }    }
   
   if (((*strp) = realloc(b, ((s = strlen(b)) + 1) * sizeof(*b)))    if (((*strp) = realloc(b, ((s = strlen(b)) + 1) * sizeof(*b))) == NULL)
       == NULL)  
   {    {
       free(b);        free(b);
       return -1;        return -1;
Line 69  vasprintf(char **strp, const char *fmt, Line 66  vasprintf(char **strp, const char *fmt,
   
   
 int  int
 asprintf(char **strp, const char *fmt, ...)  alsprintf(unsigned char **strp, const char *fmt, ...)
 {  {
   int done;    int           done;
   va_list arg;    va_list       arg;
   
   va_start(arg, fmt);    va_start(arg, fmt);
   done = vasprintf(strp, fmt, arg);    done = valsprintf(strp, fmt, arg);
   va_end(arg);    va_end(arg);
   
   return(done);    return(done);

Removed from v.1.1  
changed lines
  Added in v.1.2


CVSweb interface <joel.bertrand@systella.fr>