diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 19:52:43 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 19:52:43 (GMT) |
commit | 54c202e4ec4bc9c7e45543cea5b51868a091b3e9 (patch) | |
tree | 86e6de08c7b390c66e401a291bb83619c0cfac7e /src/H5MM.c | |
parent | 8e27e7357506958128d087c4e93e3dcb4fb52ace (diff) | |
download | hdf5-54c202e4ec4bc9c7e45543cea5b51868a091b3e9.zip hdf5-54c202e4ec4bc9c7e45543cea5b51868a091b3e9.tar.gz hdf5-54c202e4ec4bc9c7e45543cea5b51868a091b3e9.tar.bz2 |
Normalization with develop (mainly VFDs)
Diffstat (limited to 'src/H5MM.c')
-rw-r--r-- | src/H5MM.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -15,7 +15,7 @@ * * Created: H5MM.c * Jul 10 1997 - * Robb Matzke <matzke@llnl.gov> + * Robb Matzke * * Purpose: Memory management functions * @@ -449,11 +449,17 @@ H5MM_xstrdup(const char *s) FUNC_ENTER_NOAPI(NULL) +#if defined H5_MEMORY_ALLOC_SANITY_CHECK if (s) { if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDstrcpy(ret_value, s); - } /* end if */ + } +#else + if (s) + if (NULL == (ret_value = HDstrdup(s))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") +#endif done: FUNC_LEAVE_NOAPI(ret_value) @@ -483,10 +489,15 @@ H5MM_strdup(const char *s) FUNC_ENTER_NOAPI(NULL) if (!s) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "null string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed") +#if defined H5_MEMORY_ALLOC_SANITY_CHECK if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDstrcpy(ret_value, s); +#else + if (NULL == (ret_value = HDstrdup(s))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") +#endif done: FUNC_LEAVE_NOAPI(ret_value) |