summaryrefslogtreecommitdiffstats
path: root/src/H5Eint.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-10-06 05:37:12 (GMT)
committerGitHub <noreply@github.com>2021-10-06 05:37:12 (GMT)
commita45b73e4275b26505d8b659d1d807a654bb60df7 (patch)
tree721928d7f14575113d5a0b27aac21cb548c25b37 /src/H5Eint.c
parent5592111747b1e6ea1e934a3c13d3395312215c31 (diff)
downloadhdf5-a45b73e4275b26505d8b659d1d807a654bb60df7.zip
hdf5-a45b73e4275b26505d8b659d1d807a654bb60df7.tar.gz
hdf5-a45b73e4275b26505d8b659d1d807a654bb60df7.tar.bz2
VFD SWMR: Normalization with develop (#1078)
Brings many changes from develop, particularly VOL changes for async
Diffstat (limited to 'src/H5Eint.c')
-rw-r--r--src/H5Eint.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 3fd4099..6438cd9 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -129,7 +129,7 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
/* Copy the message into the user's buffer, if given */
if (msg_str) {
- HDstrncpy(msg_str, msg->msg, MIN((size_t)(len + 1), size));
+ HDstrncpy(msg_str, msg->msg, size);
if ((size_t)len >= size)
msg_str[size - 1] = '\0';
} /* end if */
@@ -772,11 +772,12 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
if (H5I_inc_ref(min_id, FALSE) < 0)
HGOTO_DONE(FAIL)
estack->slot[estack->nused].min_num = min_id;
- if (NULL == (estack->slot[estack->nused].func_name = H5MM_xstrdup(func)))
- HGOTO_DONE(FAIL)
- if (NULL == (estack->slot[estack->nused].file_name = H5MM_xstrdup(file)))
- HGOTO_DONE(FAIL)
- estack->slot[estack->nused].line = line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ estack->slot[estack->nused].func_name = func;
+ estack->slot[estack->nused].file_name = file;
+ estack->slot[estack->nused].line = line;
if (NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc)))
HGOTO_DONE(FAIL)
estack->nused++;
@@ -826,10 +827,11 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
/* Release strings */
- if (error->func_name)
- error->func_name = (const char *)H5MM_xfree_const(error->func_name);
- if (error->file_name)
- error->file_name = (const char *)H5MM_xfree_const(error->file_name);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ error->func_name = NULL;
+ error->file_name = NULL;
if (error->desc)
error->desc = (const char *)H5MM_xfree_const(error->desc);
}