summaryrefslogtreecommitdiffstats
path: root/src/H5FDsubfiling
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-08-25 20:56:50 (GMT)
committerGitHub <noreply@github.com>2023-08-25 20:56:50 (GMT)
commit627f7c5e026a55f176d8dfcab51633cf3b704ce6 (patch)
treeb8ef6ca645521104c25a7b5538259bb449d51c58 /src/H5FDsubfiling
parent3dd60d914e762c6cf7d99646bc516015229176cd (diff)
downloadhdf5-627f7c5e026a55f176d8dfcab51633cf3b704ce6.zip
hdf5-627f7c5e026a55f176d8dfcab51633cf3b704ce6.tar.gz
hdf5-627f7c5e026a55f176d8dfcab51633cf3b704ce6.tar.bz2
Convert some H5MM calls to standard C equivalents (#2382)
* H5MM_calloc and malloc are now mapped to stdlib C calls * H5MM_memcpy now maps directly to memcpy in release builds * H5MM_memcpy is still implemented as a separate function that checks for buffer overlap when H5MM_DEBUG is defined (default w/ debug builds) * Switches many library memcpy calls to use H5MM_memcpy * Fixes a possible zero allocation in H5Olayout.c
Diffstat (limited to 'src/H5FDsubfiling')
-rw-r--r--src/H5FDsubfiling/H5FDioc.c6
-rw-r--r--src/H5FDsubfiling/H5FDioc_threads.c2
-rw-r--r--src/H5FDsubfiling/H5FDsubfiling.c18
3 files changed, 13 insertions, 13 deletions
diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c
index 81ad0e7..570c747 100644
--- a/src/H5FDsubfiling/H5FDioc.c
+++ b/src/H5FDsubfiling/H5FDioc.c
@@ -399,7 +399,7 @@ H5Pget_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *config_out)
}
else {
/* Copy the IOC fapl data out */
- memcpy(config_out, config_ptr, sizeof(H5FD_ioc_config_t));
+ H5MM_memcpy(config_out, config_ptr, sizeof(H5FD_ioc_config_t));
}
done:
@@ -666,7 +666,7 @@ H5FD__ioc_fapl_copy(const void *_old_fa)
if (NULL == new_fa_ptr)
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL");
- memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_ioc_config_t));
+ H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_ioc_config_t));
ret_value = (void *)new_fa_ptr;
@@ -790,7 +790,7 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
}
/* Fill in the file config values */
- memcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_ioc_config_t));
+ H5MM_memcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_ioc_config_t));
/* Fully resolve the given filepath and get its dirname */
if (H5_resolve_pathname(name, file_ptr->comm, &file_ptr->file_path) < 0)
diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c
index f4da503..cb3458e 100644
--- a/src/H5FDsubfiling/H5FDioc_threads.c
+++ b/src/H5FDsubfiling/H5FDioc_threads.c
@@ -1304,7 +1304,7 @@ ioc_io_queue_add_entry(ioc_data_t *ioc_data, sf_work_request_t *wk_req_ptr)
assert(entry_ptr);
assert(entry_ptr->magic == H5FD_IOC__IO_Q_ENTRY_MAGIC);
- memcpy((void *)(&(entry_ptr->wk_req)), (const void *)wk_req_ptr, sizeof(sf_work_request_t));
+ H5MM_memcpy((void *)(&(entry_ptr->wk_req)), (const void *)wk_req_ptr, sizeof(sf_work_request_t));
/* must obtain io_queue mutex before appending */
hg_thread_mutex_lock(&ioc_data->io_queue.q_mutex);
diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c
index 6a04f68..89afa01 100644
--- a/src/H5FDsubfiling/H5FDsubfiling.c
+++ b/src/H5FDsubfiling/H5FDsubfiling.c
@@ -553,7 +553,7 @@ H5Pget_fapl_subfiling(hid_t fapl_id, H5FD_subfiling_config_t *config_out)
}
else {
/* Copy the subfiling fapl data out */
- memcpy(config_out, config_ptr, sizeof(H5FD_subfiling_config_t));
+ H5MM_memcpy(config_out, config_ptr, sizeof(H5FD_subfiling_config_t));
/* Copy the driver info value */
if (H5FD__copy_plist(config_ptr->ioc_fapl_id, &(config_out->ioc_fapl_id)) < 0)
@@ -811,7 +811,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf)
/* Encode config file prefix string */
if (sf_context->config_file_prefix) {
- memcpy(p, sf_context->config_file_prefix, prefix_len);
+ H5MM_memcpy(p, sf_context->config_file_prefix, prefix_len);
p += prefix_len;
}
@@ -826,7 +826,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf)
"unable to encode IOC VFD's superblock information");
/* Copy the IOC VFD's name into our buffer */
- memcpy(p, ioc_name, 9);
+ H5MM_memcpy(p, ioc_name, 9);
}
done:
@@ -893,9 +893,9 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char *
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"can't allocate space for config file prefix string");
- memcpy(sf_context->config_file_prefix, p, tmpu64);
+ H5MM_memcpy(sf_context->config_file_prefix, p, tmpu64);
- /* Just in case.. */
+ /* Just in case... */
sf_context->config_file_prefix[tmpu64 - 1] = '\0';
}
@@ -905,7 +905,7 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char *
if (file->sf_file) {
char ioc_name[9];
- memcpy(ioc_name, p, 9);
+ H5MM_memcpy(ioc_name, p, 9);
p += 9;
if (H5FD_sb_load(file->sf_file, ioc_name, p) < 0)
@@ -960,7 +960,7 @@ H5FD__subfiling_fapl_get(H5FD_t *_file)
}
/* Copy the fields of the structure */
- memcpy(fa, &(file->fa), sizeof(H5FD_subfiling_config_t));
+ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_subfiling_config_t));
/* Copy the driver info value */
if (H5FD__copy_plist(file->fa.ioc_fapl_id, &(fa->ioc_fapl_id)) < 0)
@@ -1036,7 +1036,7 @@ H5FD__subfiling_fapl_copy(const void *_old_fa)
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
}
- memcpy(new_fa, old_fa, sizeof(H5FD_subfiling_config_t));
+ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_subfiling_config_t));
if (H5FD__copy_plist(old_fa->ioc_fapl_id, &(new_fa->ioc_fapl_id)) < 0)
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy the IOC FAPL");
@@ -1169,7 +1169,7 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma
config_ptr = &default_config;
}
- memcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_subfiling_config_t));
+ H5MM_memcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_subfiling_config_t));
if (H5FD__copy_plist(config_ptr->ioc_fapl_id, &(file_ptr->fa.ioc_fapl_id)) < 0) {
file_ptr->fa.ioc_fapl_id = H5I_INVALID_HID;
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy FAPL");