diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-10-06 05:37:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 05:37:12 (GMT) |
commit | a45b73e4275b26505d8b659d1d807a654bb60df7 (patch) | |
tree | 721928d7f14575113d5a0b27aac21cb548c25b37 /src/H5CS.c | |
parent | 5592111747b1e6ea1e934a3c13d3395312215c31 (diff) | |
download | hdf5-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/H5CS.c')
-rw-r--r-- | src/H5CS.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -262,9 +262,9 @@ H5CS_copy_stack(void) if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records") - /* Copy old stack to new one, duplicating the strings */ - for (u = 0; u < old_stack->nused; u++) - new_stack->rec[u] = HDstrdup(old_stack->rec[u]); + /* Copy pointers on old stack to new one */ + /* (Strings don't need to be duplicated, they are statically allocated) */ + HDmemcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused); new_stack->nused = new_stack->nalloc = old_stack->nused; /* Set the return value */ @@ -298,11 +298,9 @@ H5CS_close_stack(H5CS_t *stack) HDassert(stack); /* Free stack */ - for (u = 0; u < stack->nused; u++) { - if (stack->rec[u]) - HDfree((void *)stack->rec[u]); - stack->rec[u] = NULL; - } /* end for */ + /* The function name string are statically allocated (by the compiler) + * and are not allocated, so there's no need to free them. + */ if (stack->rec) { HDfree(stack->rec); stack->rec = NULL; |