diff options
Diffstat (limited to 'src/H5Eint.c')
-rw-r--r-- | src/H5Eint.c | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/H5Eint.c b/src/H5Eint.c index 78b28de..c743ddb 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -650,11 +650,7 @@ herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { - va_list ap; /* Varargs info */ -#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 */ + va_list ap; /* Varargs info */ 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 */ @@ -683,31 +679,9 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin 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_DONE(FAIL) -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if (NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_DONE(FAIL) - - /* 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_DONE(FAIL) - } /* 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) @@ -716,16 +690,11 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin 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_NOAPI(ret_value) } /* end H5E_printf_stack() */ |