avoid use of vasnprintf in base/error.c

commit c94f299fc8 uses vasnprintf
which was previously removed from the libheimbase directory in
order to prevent a dependency on libroken.

Replace vasnprintf with snprintf and malloc to avoid the
dependency.

Change-Id: I029e7e6883406ca7311490a3dab4b65cad3ba70b
This commit is contained in:
Jeffrey Altman
2011-09-26 01:53:25 -04:00
parent 3854e64a4a
commit 91a9a11b75

View File

@@ -92,12 +92,17 @@ heim_error_t
heim_error_createv(int error_code, const char *fmt, va_list ap)
{
heim_error_t e;
char *str = NULL;
char *str;
int len;
len = vasprintf(&str, fmt, ap);
if (len < 0 || str == NULL)
str = malloc(1024);
if (str == NULL)
return NULL;
len = vsnprintf(str, 1024, fmt, ap);
if (len < 0) {
free(str);
return NULL;
}
e = _heim_alloc_object(&_heim_error_object, sizeof(struct heim_error));
if (e) {