diff options
Diffstat (limited to 'src/H5E.c')
-rw-r--r-- | src/H5E.c | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -1356,10 +1356,6 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, { va_list ap; /* Varargs info */ H5E_t *estack; /* Pointer to error stack to modify */ -#ifndef H5_HAVE_VASPRINTF - int tmp_len; /* Current size of description buffer */ - int desc_len; /* Actual length of description when formatted */ -#endif /* H5_HAVE_VASPRINTF */ char *tmp = NULL; /* Buffer to place formatted description in */ hbool_t va_started = FALSE; /* Whether the variable argument list is open */ herr_t ret_value=SUCCEED; /* Return value */ @@ -1389,31 +1385,9 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, HDva_start(ap, fmt); va_started = TRUE; -#ifdef H5_HAVE_VASPRINTF /* Use the vasprintf() routine, since it does what we're trying to do below */ if(HDvasprintf(&tmp, fmt, ap) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ - while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { - /* shutdown & restart the va_list */ - HDva_end(ap); - HDva_start(ap, fmt); - - /* Release the previous description, it's too small */ - H5MM_xfree(tmp); - - /* Allocate a description of the appropriate length */ - tmp_len = desc_len + 1; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end while */ -#endif /* H5_HAVE_VASPRINTF */ /* Push the error on the stack */ if(H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) @@ -1422,16 +1396,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, done: if(va_started) HDva_end(ap); -#ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree */ if(tmp) HDfree(tmp); -#else /* H5_HAVE_VASPRINTF */ - if(tmp) - H5MM_xfree(tmp); -#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ |