diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-06-23 15:36:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-06-23 15:36:35 (GMT) |
commit | 7c3df64cc4742c0316ca81aeef67bd95a5737c70 (patch) | |
tree | f6aa023c661a881b2495ea0be4e745b43eea091f /src/H5Spoint.c | |
parent | 19644d75931aaa79951830d85eda28de08f17180 (diff) | |
download | hdf5-7c3df64cc4742c0316ca81aeef67bd95a5737c70.zip hdf5-7c3df64cc4742c0316ca81aeef67bd95a5737c70.tar.gz hdf5-7c3df64cc4742c0316ca81aeef67bd95a5737c70.tar.bz2 |
[svn-r8731] Purpose:
Code cleanup & minor optimization
Description:
Re-work the way interface initialization routines are specified in the
library to avoid the overhead of checking for them in routines where there is
no interface initialization routine. This cleans up warnings with gcc 3.4,
reduces the library binary size a bit (about 2-3%) and should speedup the
library's execution slightly.
Platforms tested:
FreeBSD 4.10 (sleipnir) w/gcc34
h5committest
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r-- | src/H5Spoint.c | 81 |
1 files changed, 31 insertions, 50 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c index dc42f11..11802e5 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -23,7 +23,7 @@ /* Pablo information */ /* (Put before include files to avoid problems with inline functions) */ -#define PABLO_MASK H5Spoint_mask +#define PABLO_MASK H5S_point_mask #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -33,10 +33,6 @@ #include "H5Spkg.h" /* Dataspace functions */ #include "H5Vprivate.h" /* Vector functions */ -/* Interface initialization */ -#define INTERFACE_INIT NULL -static int interface_initialize_g = 0; - /* Static function prototypes */ /* Selection callbacks */ @@ -121,9 +117,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5S_point_iter_init, FAIL); + FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init); /* Check args */ assert (space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); @@ -138,8 +132,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Initialize type of selection iterator */ iter->type=H5S_sel_iter_point; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_iter_init() */ @@ -394,7 +387,7 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t * unsigned i; /* Counter */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_point_add, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_add); assert(space); assert(num_elem>0); @@ -472,13 +465,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_release (H5S_t *space) { H5S_pnt_node_t *curr, *next; /* Point selection nodes */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_point_release, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release); /* Check args */ assert (space); @@ -499,8 +491,7 @@ H5S_point_release (H5S_t *space) /* Reset the number of elements in the selection */ space->select.num_elem=0; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_release() */ @@ -591,13 +582,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) { H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_copy, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy); assert(src); assert(dst); @@ -653,14 +644,14 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_point_is_valid (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ unsigned u; /* Counter */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_is_valid, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid); assert(space); @@ -672,10 +663,8 @@ H5S_point_is_valid (const H5S_t *space) /* Check if an offset has been defined */ /* Bounds check the selected point + offset against the extent */ if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.size[u]) - || ((curr->pnt[u]+space->select.offset[u])<0)) { - ret_value=FALSE; - break; - } /* end if */ + || ((curr->pnt[u]+space->select.offset[u])<0)) + HGOTO_DONE(FALSE) } /* end for */ curr=curr->next; @@ -744,13 +733,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hssize_t +static hssize_t H5S_point_serial_size (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ hssize_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_serial_size, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size); assert(space); @@ -768,7 +757,6 @@ H5S_point_serial_size (const H5S_t *space) curr=curr->next; } /* end while */ -done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5S_point_serial_size() */ @@ -792,16 +780,15 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_serialize (const H5S_t *space, uint8_t *buf) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_point_serialize, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize); assert(space); @@ -836,8 +823,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_serialize() */ @@ -860,7 +846,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_deserialize (H5S_t *space, const uint8_t *buf) { H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */ @@ -870,7 +856,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) unsigned i,j; /* local counting variables */ herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_deserialize, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_deserialize); /* Check args */ assert(space); @@ -1048,15 +1034,14 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) { H5S_pnt_node_t *node; /* Point node */ int rank; /* Dataspace rank */ int i; /* index variable */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5S_point_bounds, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_bounds); assert(space); assert(start); @@ -1083,8 +1068,7 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) node=node->next; } /* end while */ -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_bounds() */ @@ -1109,12 +1093,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_point_is_contiguous(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_is_contiguous, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous); assert(space); @@ -1124,7 +1108,6 @@ H5S_point_is_contiguous(const H5S_t *space) else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ ret_value=FALSE; -done: FUNC_LEAVE_NOAPI(ret_value); } /* H5S_point_is_contiguous() */ @@ -1147,12 +1130,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_point_is_single(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_is_single, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single); assert(space); @@ -1162,7 +1145,6 @@ H5S_point_is_single(const H5S_t *space) else ret_value=FALSE; -done: FUNC_LEAVE_NOAPI(ret_value); } /* H5S_point_is_single() */ @@ -1188,12 +1170,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +static htri_t H5S_point_is_regular(const H5S_t *space) { htri_t ret_value; /* return value */ - FUNC_ENTER_NOAPI(H5S_point_is_regular, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular); /* Check args */ assert(space); @@ -1204,7 +1186,6 @@ H5S_point_is_regular(const H5S_t *space) else ret_value=FALSE; -done: FUNC_LEAVE_NOAPI(ret_value); } /* H5S_point_is_regular() */ @@ -1301,7 +1282,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t +static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) @@ -1317,7 +1298,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, int i; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI (H5S_point_get_seq_list, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list); /* Check args */ assert(space); |