summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-05-15 10:33:42 (GMT)
committerGitHub <noreply@github.com>2021-05-15 10:33:42 (GMT)
commitbf4a260b53f435a6ea98f306ff684ae4f354566e (patch)
tree07efdaf87efb0b923dcc9d90a040d2ac944b81bb /src/H5HL.c
parent8977e43b7766f4f817fa067b2d22e84b775bf5a2 (diff)
downloadhdf5-bf4a260b53f435a6ea98f306ff684ae4f354566e.zip
hdf5-bf4a260b53f435a6ea98f306ff684ae4f354566e.tar.gz
hdf5-bf4a260b53f435a6ea98f306ff684ae4f354566e.tar.bz2
Merge PRs in issue #642 to hdf5_1_12 (#643)
* Snapshot version 1.12 release 1-3. Update version to 1.12.1-4. * First cut of the H5 public API documentation. (#80) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Full set of current H5F documentation. (#105) * First cut of the H5 public API documentation. * Added H5Z "bonus track." * Applied Quincey's patch. * Added the missing patches from Quincey's original patch. * H5PL (complete) and basic H5VL API documentation. * Added H5I API docs. * Added H5L API docs. * First installment from Elena's H5T batch. * Second installment of Elena's H5T batch. * Final installment of Elena's H5T batch. * Migrated documentation for SWMR functions. * Catching up on MDC functions. * Integrated the H5F MDC function documentation. * Added MDC and parallel H5F functions. * Slightly updated main page. * Added doxygen/dox/H5AC_cache_config_t.dox to MANIFEST. * Doxygen - added (mostly) beginner functions (#112) * Doxygen - added (mostly) beginner functions * Removed duplicate H5Pset_szip function * Add src/H5module.h to MANIFEST. * close #195. (#196) * Update HDF5PluginMacros.cmake * Update HDF5PluginMacros.cmake * Avoid aligned access for references by decoding into temporary buffer and then copying the result into the actual buffer. Update test to be more thorough with using compound datatype fields everywhere. (#206) * Modify temporary rpath for testing in java example scripts. (#230) * Fix undefined left shifting of negative numbers (#338) Undefined Bahavior Sanitizer errored here about left shifting negative numbers. * Fixes various warnings noticed on Windows (#425) * Fixes various warnings noticed on Windows - Adds a prototype for our implementation of vasprintf - Return type of H5_get_utf16_str() is now non-const - Fixes possible uninitialized return type in Wremove_utf8 - Better isolation of fork() code in accum.c:test_swmr_write_big() - Better isolation of non-zlib code in dsets.c:test_filter_delete() - Removed unused variable in trefer.c:test_reference_cmpnd_obj() * Fixes clang-format issues * Applied clang-tidy readability-non-const-parameter warning fixes auto… (#429) * Automatically applied clang-tidy readability-avoid-const-params-in-decls fixes Removes useless const declarations. * Fixed most readability-non-const-parameter warnings These changes were made automatically by clang-tidy, but I manually reverted the changes related to the H5Z_func_t signature. * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Added C++11 override keyword where appropriate (#433) Added H5_OVERRIDE macro for compatibility with both C++11 and older. * Various clang tidy warning fixes (#448) * Fixed clang-tidy bugprone-reserved-identifier warnings * Fixed clang-tidy bugprone-assert-side-effect warnings * Fixed clang-tidy bugprone-copy-constructor-init warning * Fixed clang-tidy readability-redundant-preprocessor warning For error_test.c the removed code was already dead, because it was in the else of an `#if H5_USE_16_API` block. Based on H5Location.h, I think p_get_ref_obj_type was meant to be in `#ifndef DOXYGEN_SHOULD_SKIP_THIS` and an `#endif` was missing. Similarly, in the header, getObjTypeByIdx is only in H5_NO_DEPRECATED_SYMBOLS, not DOXYGEN_SHOULD_SKIP_THIS. * Fixed clang-tidy readability-redundant-string-init warnings * Fixed some clang-tidy performance-type-promotion-in-math-fn warnings * Fixed clang-tidy performance-unnecessary-value-param warnings * Reformat source with clang v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Removed checks/workarounds for pre-C++89 compatibility (#449) After 30+ years, just assume that the following exist: - extension-less includes - namespaces - std:: - static_cast - bool * Fixed all clang-tidy bugprone-suspicious-string-compare warnings (#451) * Fixed all clang-tidy bugprone-suspicious-string-compare warnings This change was generated entirely by clang-tidy itself. * Reformat code with clang v10.0.1. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Remove 2 functions incorrectly merged from develop in a cherry-pick merge of PR #451. * Minor parallel improvements (#519) * Improve MPI error reporting, handled failed operations in parallel tests more nicely, and clean up MPI_Allreduce for determining whether to break collective I/O * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Clean up MPI-IO VFD tracing support (#520) * Clean up tracing support * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Brings the native implementation of H5Fdelete() from Bitbucket (#524) * Committing clang-format changes * Brings the native VFD H5Fdelete() implementation from Bitbucket Only brings the 'del' callbacks, not the 'open/close' scheme. * Formatter changes * Committing clang-format changes * Fixes direct VFD callback name * Removes UNUSED macro from family API call * Adds barrier and rank 0 check to MPI-I/O VFD delete * Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete" This reverts commit 909765f759d9d96e84f4b8b1cc14f7d2b3ac8143. * Revert "Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete"" This reverts commit 9b04bef1157853fc79fcb8fcc3e8ba1371091702. * Adds a second barrier after the delete in MPI-I/O VFD * Only delete files in the core VFD when the backing store flag is set * Fixes string issues in multi VFD Also, h5test.c cleanup code now uses H5Fdelete(). * Formatted source * Rework fapl checks for MPI-I/O VFD delete callback Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Minor warning fixes in develop (#526) * Committing clang-format changes * Minor warning fixes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes implementation of my_strdup() from the multi VFD (#527) * Committing clang-format changes * Removes my_strdup() from the multi VFD * Use strdup directly when memory sanity checks are off Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes dead H5ST package from the library (#528) * Committing clang-format changes * Removes the unused H5ST package from the library Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix HDFFV-11232 (#530) * fixed missed closing of a dataset * fixed missed closing of a dataset * fixed typo in error return * Committing clang-format changes * minor edits * code format * Committing clang-format changes * code format * minor edit * added H5fortkit dependency for H5VLff.F90, HDFFV-11232 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fixes incorrect usage of H5I_BADID (#554) * Committing clang-format changes * Fixes incorrect use of H5I_BADID Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fixes a segfault when H5Pset_mdc_log_options is called multiple times on a fapl (#601) * Committing clang-format changes * Fixes a segfault when H5Pset_mdc_log_options() is called multiple times An internal string is incorrectly freed when the API call is invoked multiple times on a property list, which will usually cause a segfault to occur. On the first call the log location is NULL so the problem doesn't occur. Fixes HDFFV-11239 * Fixes typos Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix for a segfault when H5Pset_fapl_log is passed an invalid fapl ID (#607) * Committing clang-format changes * Fixes an issue where H5Pset_fapl_log sefaults when passed an invalid fapl ID This was due to a pointer-containing struct being memset after the first internal API call. If the first call failed, the error condition would check if the pointer was not NULL and then attempt to free it if not. This would lead to the freeing of a wild pointer if an invalid fapl ID were passed in. This was fixed by reordering the memset and adding a test to ensure the problem stays fixed. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fixes crashes when size_hint > UINT32_MAX is passed to H5Gcreate1 (#611) * Committing clang-format changes * Fixes incorrect size_hint handling in H5Gcreate1 * Updates the size hint type for group creation * Updates the RELEASE.txt note * Revert "Updates the RELEASE.txt note" This reverts commit 3df386acca806d652bbe2209f7c4503b30f068ff. * Reverts previous behavior to use a uint32_t struct field * Updates RELEASE.txt Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Revert "Brings the native implementation of H5Fdelete() from Bitbucket (#524)" This reverts commit 38d1b121ae428138b8863c2a319518c7363c2d94. * Removed mentions of Wdeclaration-after-statement now that C99 is requ… (#447) * Removed mentions of Wdeclaration-after-statement now that C99 is required * Remove -Werror=declaration-after-statement from error-general file. Co-authored-by: Larry Knox <lrknox@hdfgroup.org> * Made private my_yyinput function static (#618) This prevents it being exported as a public symbol. * Adds const to a few global variables (#623) * Committing clang-format changes * Adds consts to a few global variables Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * (fix) Segmentation fault when using a compound type. (#143) * (fix) Segmentation fault when using a compound type. In the case when a compounded attribute is written to dataset followed by writing the data with a data transform function to the dataset will result in a segmentation fault. It turns out the data is classified as compounded while it is not. Now, the state is always reset first to not compounded followed by the existing check if the variable is compounded. * (fix) Removed undesired comment lines. * (fix) Segmentation fault when using a compound type: added test. * (fix) Added the missing cmpd_transform.c file to MANIFEST. * (fix) cmpd_dtransform test: autotools and source header. Added the cmp_dtransform test to the autotools configuration and updated the HDF Group copyright header. Co-authored-by: Jan-Willem Blokland <Jan-Willem.Blokland@Shell.com> * (fix) H5Z_xform_create function and scientific notation (#144) * (fix) H5Z_xform_create function and scientific notation Implemented a more sophisticated check to support scientific notation in the expression of the H5Zset_data_transform function. * (fix) H5Z_xform_create and scientific notation: Added test. Added a test to demonstrate that the parsing of expression which includes scientific notation works correctly. Improved inline comment. Co-authored-by: Jan-Willem Blokland <Jan-Willem.Blokland@Shell.com> * Committing clang-format changes * Fix H5Eget_auto2/H5Eauto_is_v2 to not clear error stack (#625) * Cleanup tools debug build warnings (#627) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * h5diff subset indexing (#628) * OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * HDFFV-11113 long double in tools * HDFFV-11113 add note * Disable long double tests for now * HDFFV-11228 remove arbitrary CMake warning groups. * Make each flag a string * Some Javadoc warning fixes * Updated javadoc fixes * # WARNING: head commit changed in the meantime HDFFV-11229 Fix long double usage in tools and java Changed h5dump and h5ls to just print 128-bit for long double type. Added test and file for dataset and attributes with all three float types. * Committing clang-format changes * HDFFV-11229 Add release note * HDFFV-11229 windows testfile needed * fix typo * Remove non supported message text * HDFFV-11229 - change ldouble test to check both native and general * HDFFV-11229 add second file compare * HDFFV-11229 fix reference file * HDFFV-11229 autotools check two refs * HDFFV-11229 revert back to removal of NATIVE_LDOUBLE in tools output * Committing clang-format changes * Update release note * Update attribute type of ref file * Change source of ninja for macs * try port instead of brew * Recommended is to use brew. * Undo non long double changes * remove unneeded file * Fix perl and doxygen CMake code * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument * Add stamp files to BYPRODUCTS * Only one copy of file exists * Fix custom cmmand depends targets * Fix fortran custom command DEPENDS * Add LD_LIBRARY_PATH to tests * Add custom target for DEPENDS * Add h5detect conditionaly to generated target DEPENDS * Correct DEPENDS targets * Parallel builds need the mpi compiler for pkgconfig scripts. * install only if MPI build * Fortran target depends * Remove incorrect source attribute * doxygen adjustments * doxygen build updates * Correct version * Correct function version - function has been merged to 1.12 * Correct version string for map functions * Cleanup warnings for tools debug builds * TRILAB-227 - fix indexing for h5diff selections * Correct location of pos to index function call Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes gratuitous (double)x.yF casts (#632) * Committing clang-format changes * Removes gratuitous (double)x.yF casts * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Cleans up a const warning left over from previous constification (#633) * Committing clang-format changes * Adds consts to a few global variables * Cleans up a const warning left over from previous constification Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Purges UFAIL from the library (#637) * Committing clang-format changes * Purges UFAIL from the library * H5HL_insert change requested in PR Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Bmr dev hdffv 11223 (#640) * Fixed HDFFV-11223 (CVE-2018-14460) Description - Added checks against buffer size to prevent segfault, in case of data corruption, for sdim->size and sdim->max. - Renamed data files in an existing test to shorten their length as agreed with other developers previously. Platforms tested: Linux/64 (jelly) * Committing clang-format changes * Updated for test files * Updated for HDFFV-11223 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Revert "Fix H5Eget_auto2/H5Eauto_is_v2 to not clear error stack (#625)" This reverts commit 7a682862846fa206aa3a0151c0aa08d7c759b1f7. Co-authored-by: Gerd Heber <gheber@hdfgroup.org> Co-authored-by: bljhdf <58825073+bljhdf@users.noreply.github.com> Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org> Co-authored-by: Quincey Koziol <quincey@koziol.cc> Co-authored-by: Sean McBride <sean@rogue-research.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: Quincey Koziol <koziol@lbl.gov> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org> Co-authored-by: Jan-Willem Blokland <J.W.S.Blokland@XS4All.nl> Co-authored-by: Jan-Willem Blokland <Jan-Willem.Blokland@Shell.com> Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com>
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index 50d24c3..ca83445 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -508,27 +508,31 @@ END_FUNC(STATIC) /* end H5HL__dirty() */
*
* Purpose: Inserts a new item into the heap.
*
- * Return: Success: Offset of new item within heap.
- * Failure: UFAIL
+ * Return: Success: SUCCEED
+ * Offset set to location of new item within heap
+ *
+ * Failure: FAIL
+ * Offset set to SIZE_MAX
*
* Programmer: Robb Matzke
* Jul 17 1997
*
*-------------------------------------------------------------------------
*/
-BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
- H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
+BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
+ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out))
H5HL_free_t *fl = NULL, *last_fl = NULL;
- size_t offset = 0;
size_t need_size;
+ size_t offset = 0;
hbool_t found;
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(buf_size > 0);
HDassert(buf);
+ HDassert(offset_out);
/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
@@ -539,20 +543,18 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
if (FAIL == H5HL__dirty(heap))
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");
- /*
- * In order to keep the free list descriptors aligned on word boundaries,
+ /* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
* a word.
*/
need_size = H5HL_ALIGN(buf_size);
- /*
- * Look for a free slot large enough for this object and which would
+ /* Look for a free slot large enough for this object and which would
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) {
if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) {
- /* a big enough free block was found */
+ /* A big enough free block was found */
offset = fl->offset;
fl->offset += need_size;
fl->size -= need_size;
@@ -562,20 +564,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
break;
}
else if (fl->size == need_size) {
- /* free block of exact size found */
+ /* Free block of exact size found */
offset = fl->offset;
fl = H5HL__remove_free(heap, fl);
found = TRUE;
break;
}
else if (!last_fl || last_fl->offset < fl->offset) {
- /* track free space that's closest to end of heap */
+ /* Track free space that's closest to end of heap */
last_fl = fl;
}
} /* end for */
- /*
- * If no free chunk was large enough, then allocate more space and
+ /* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
* can extend that free chunk. Otherwise we'll have to make another
* free chunk. If the heap must expand, we double its size.
@@ -587,7 +588,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
htri_t was_extended; /* Whether the local heap's data segment on disk was extended */
/* At least double the heap's size, making certain there's enough room
- * for the new object */
+ * for the new object
+ */
need_more = MAX(need_size, heap->dblk_size);
/* If there is no last free block or it's not at the end of the heap,
@@ -657,8 +659,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
}
} /* end if */
else {
- /*
- * Create a new free list element large enough that we can
+ /* Create a new free list element large enough that we can
* take some space out of it right away.
*/
offset = old_dblk_size;
@@ -700,11 +701,10 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);
- /* Set return value */
- ret_value = offset;
+ *offset_out = offset;
CATCH
- /* No special processing on errors */
+ /* No special processing on exit */
END_FUNC(PRIV) /* H5HL_insert() */