a bit cleaner.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4763 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-03-24 19:54:38 +00:00
parent db9e1c549b
commit 496bae429a
1 changed files with 4 additions and 6 deletions

View File

@ -618,17 +618,15 @@ SWITCH_DECLARE(int) switch_vasprintf(char **ret, const char *fmt, va_list ap)
size_t buflen;
len = vsnprintf(NULL, 0, fmt, ap);
if (len > 0) {
buflen = (size_t)(len + 1);
if ((buf = malloc(buflen)) == NULL) {
*ret = NULL;
return -1;
}
if (len > 0 && (buf = malloc((buflen = (size_t)(len + 1)))) != NULL) {
len = vsnprintf(buf, buflen, fmt, ap);
*ret = buf;
} else {
*ret = NULL;
len = -1;
}
return len;
#endif