summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 8dd72cd..198757b 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -3491,9 +3491,9 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - (file->accum_size + size)));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Move the existing metadata to the proper location */
@@ -3519,9 +3519,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size + size, 0, (file->accum_buf_size - (file->accum_size + size)));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Copy the new metadata to the end */
@@ -3554,9 +3554,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - file->accum_size));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Calculate the proper offset of the existing metadata */
@@ -3588,9 +3588,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - file->accum_size));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Copy the new metadata to the end */
@@ -3625,9 +3625,12 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Note the new buffer size */
file->accum_buf_size=size;
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+{
+size_t clear_size = MAX(file->accum_size, size);
+HDmemset(file->meta_accum + clear_size, 0, (file->accum_buf_size - clear_size));
+}
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
else {
/* Check if we should shrink the accumulator buffer */