Unverified Commit 4988e7c5 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'sunweaver-pr/drop-NoMachines-own-Xvasprintf-implementation' into 3.6.x

Attributes GH PR #597: https://github.com/ArcticaProject/nx-libs/pull/597 Reviewed+approved by Mihai Moldovan (via IRC): 2017-12-11: ``` 09:38 < Ionic> okay 09:38 < Ionic> in that case it's probably really best to drop it completely ```
parents c31cd773 cf2e0765
...@@ -89,54 +89,7 @@ ...@@ -89,54 +89,7 @@
#undef TEST #undef TEST
#undef DEBUG #undef DEBUG
#define START_SIZE 256 #endif
#define END_SIZE 2048
int
Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
{
char *newret;
int size;
int r;
size = 0;
for (;;)
{
if (size == 0)
{
*ret = (char *)malloc(START_SIZE);
if (*ret == NULL)
return -1;
size = START_SIZE;
}
else if (size < END_SIZE &&
(newret = (char *) realloc(*ret, 2 * size)) != NULL)
{
*ret = newret;
size = 2 * size;
}
else
{
free(*ret);
return -1;
}
r = vsnprintf(*ret, size, format, va);
if (r == -1 || r == size || r > size || r == size - 1)
{
continue;
}
else
{
(*ret)[r] = 0;
return r;
}
}
}
#else
/** /**
* Varargs sprintf that allocates a string buffer the right size for * Varargs sprintf that allocates a string buffer the right size for
...@@ -171,8 +124,6 @@ Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) ...@@ -171,8 +124,6 @@ Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va)
#endif #endif
} }
#endif
#ifndef HAVE_VASPRINTF #ifndef HAVE_VASPRINTF
#define vasprintf Xvasprintf #define vasprintf Xvasprintf
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment