From 6d2a1448520c4e5ff6f7610c26bb943ef3e361e1 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 10 Jul 2007 15:07:58 -0500 Subject: [svn-r13961] Description: Remove some unnecessary code that checks for fill value buffer being NULL. Tested on: Mac OS X/32 10.4.10 (amazon) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- src/H5Sselect.c | 75 +++++++++++++++++++++++---------------------------------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 844317b..e3b90bb 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1433,82 +1433,67 @@ done: 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) { H5S_sel_iter_t iter; /* Selection iteration info */ hbool_t iter_init = 0; /* Selection iteration info has been initialized */ - H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */ - uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */ - uint8_t *buf; /* Current location in buffer */ - const void *fill; /* Alias for fill-value buffer */ hssize_t nelmts; /* Number of elements in selection */ - hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ - size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ - size_t nseq; /* Number of sequences generated */ - size_t curr_seq; /* Current sequnce being worked on */ - size_t nelem; /* Number of elements used in sequences */ size_t max_elem; /* Total number of elements in selection */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_select_fill, FAIL); + FUNC_ENTER_NOAPI(H5S_select_fill, FAIL) /* Check args */ - assert(fill_size>0); - assert(space); - assert(_buf); - - /* Check if we need a temporary fill value buffer */ - if(_fill == NULL) { - /* Wrap the local buffer for elements */ - if(NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer") - - /* Get a pointer to a buffer that's large enough for element */ - if(NULL == (fill = H5WB_actual_clear(elem_wb, fill_size))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer") - } /* end if */ - else - fill = _fill; + HDassert(fill); + HDassert(fill_size > 0); + HDassert(space); + HDassert(_buf); /* Initialize iterator */ - if (H5S_select_iter_init(&iter, space, fill_size)<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); - iter_init=1; /* Selection iteration info has been initialized */ + if(H5S_select_iter_init(&iter, space, fill_size) < 0) + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + iter_init = 1; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0) - HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); + if((nelmts = H5S_GET_SELECT_NPOINTS(space)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") /* Compute the number of bytes to process */ - H5_ASSIGN_OVERFLOW(max_elem,nelmts,hssize_t,size_t); + H5_ASSIGN_OVERFLOW(max_elem, nelmts, hssize_t, size_t); /* Loop, while elements left in selection */ - while(max_elem>0) { + while(max_elem > 0) { + hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ + size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ + size_t nseq; /* Number of sequences generated */ + size_t curr_seq; /* Current sequnce being worked on */ + size_t nelem; /* Number of elements used in sequences */ + /* Get the sequences of bytes */ if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") /* Loop over sequences */ - for(curr_seq=0; curr_seq