os_specific.c
Go to the documentation of this file.
00001 #include "os_specific.h"
00002 
00003 #ifdef WINDOWS
00004 
00005 int vasprintf(char** strp, const char* fmt, va_list ap){
00006   int n;
00007   int size = 100;
00008   char* p;
00009   char* np;
00010 
00011   if ((p = (char*)malloc(size * sizeof(char))) == NULL)
00012     return -1;
00013 
00014   while (1) {
00015     n = vsnprintf(p, size, fmt, ap);
00016     if (n > -1 && n < size) {
00017       *strp = p;
00018       return n;
00019     }
00020     if (n > -1)
00021       size = n+1;
00022     else
00023       size *= 2;
00024     if ((np = (char*)realloc (p, size * sizeof(char))) == NULL) {
00025       free(p);
00026       return -1;
00027     } else
00028       p = np;
00029   }
00030 }
00031 
00032 
00033 #endif


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:58