summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-25 13:15:22 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-25 13:15:22 (GMT)
commit58b570935b7a16dee14b25dd29c97c384289784a (patch)
treef1bd138a933154a1df5d773b41f4b570e56e285b /src
parent34fd49d1e4879c2c63bf4291a094b90123159f6e (diff)
downloadhdf5-58b570935b7a16dee14b25dd29c97c384289784a.zip
hdf5-58b570935b7a16dee14b25dd29c97c384289784a.tar.gz
hdf5-58b570935b7a16dee14b25dd29c97c384289784a.tar.bz2
[svn-r5254] Purpose:
Code tweak. Description: Allow the 'fill' parameter of H5S_select_fill to be NULL and allocate a temporary buffer for it, if so. Platforms tested: FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r--src/H5Sselect.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index b7beed1..e282006 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1565,18 +1565,24 @@ H5S_select_regular(const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
+H5S_select_fill(const void *_fill, size_t fill_size, const H5S_t *space, void *buf)
{
- herr_t ret_value=FAIL; /* return value */
+ const void *fill=_fill; /* Alias for fill-value buffer */
+ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5S_select_fill, FAIL);
/* Check args */
- assert(fill);
assert(fill_size>0);
assert(space);
assert(buf);
+ /* Check if we need a temporary fill value buffer */
+ if(fill==NULL) {
+ if (NULL==(fill = H5MM_calloc(fill_size)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "fill value buffer allocation failed");
+ } /* end if */
+
/* Fill the selection in the memory buffer */
/* [Defer (mostly) to the selection routines] */
switch(space->select.type) {
@@ -1602,6 +1608,10 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *bu
break;
} /* end switch */
+done:
+ if(_fill==NULL && fill)
+ H5MM_xfree(fill);
+
FUNC_LEAVE (ret_value);
} /* H5S_select_fill() */