File:  [DVB] / dietlibc / libugly / asprintf.c
Revision 1.6: download - view: text, annotated - select for diffs
Tue May 2 21:41:28 2017 UTC (7 years, 1 month ago) by leitner
Branches: MAIN
CVS tags: HEAD
remove most gcc 7 warnings

#include <stdarg.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include "dietwarning.h"

int asprintf(char **s, const char *format,...)
{
  int n;
  va_list arg_ptr;
  char tmp[8];
  va_start(arg_ptr, format);
  n=vsnprintf(tmp,0,format,arg_ptr);
  va_start (arg_ptr, format);
  if ((*s=malloc(n+1))) {
    n=vsnprintf(*s,n+1,format,arg_ptr);
    return n;
  }
  return -1;
}

LinuxTV legacy CVS <linuxtv.org/cvs>