diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-08-08 16:52:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-08-08 16:52:55 (GMT) |
commit | d8397a6f426227d09d20e647ce8b12b8c6295b2d (patch) | |
tree | 2943fbfd2bfb66cf167eb642835fdb4deb3afd3c /src/H5Tbit.c | |
parent | 573307786a1f5f7ce597e5191ea08c3bbd95b66c (diff) | |
download | hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.zip hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.gz hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.bz2 |
[svn-r5842] Purpose:
Code cleanup
Description:
Change most (all?) HRETURN_ERROR macros to HGOTO_ERROR macros, along with
HRETURN macros to HGOTO_DONE macros. This unifies the error return path
from functions and reduces the size of the library by up to 10% on some
platforms.
Additionally, I improved a lot of the error cleanup code in many routines.
Platforms tested:
FreeBSD 4.6 (sleipnir) serial & parallel and IRIX64 6.5 (modi4) serial &
parallel.
Diffstat (limited to 'src/H5Tbit.c')
-rw-r--r-- | src/H5Tbit.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 0813f46..abc39b0 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -317,6 +317,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, ssize_t base=(ssize_t)offset; ssize_t idx, i; size_t iu; + ssize_t ret_value=(-1); /* Return value */ /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ FUNC_ENTER_NOINIT(H5T_bit_find); @@ -333,9 +334,8 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* Beginning */ if (offset) { for (iu=offset; iu<8 && size>0; iu++, size--) { - if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) { - HRETURN(8*idx+(ssize_t)iu - base); - } + if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)iu - base); } offset = 0; idx++; @@ -344,9 +344,8 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, while (size>=8) { if ((value?0x00:0xff)!=buf[idx]) { for (i=0; i<8; i++) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - HRETURN(8*idx+i - base); - } + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); } } size -= 8; @@ -354,9 +353,8 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } /* End */ for (i=0; i<(ssize_t)size; i++) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - HRETURN(8*idx+i - base); - } + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); } break; @@ -368,9 +366,8 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* Beginning */ if (size>8-offset && (offset+size)%8) { for (iu=(offset+size)%8; iu>0; --iu, --size) { - if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - HRETURN(8*idx+(ssize_t)(iu-1) - base); - } + if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); } --idx; } @@ -378,9 +375,8 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, while (size>=8) { if ((value?0x00:0xff)!=buf[idx]) { for (i=7; i>=0; --i) { - if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - HRETURN(8*idx+i - base); - } + if (value==(hbool_t)((buf[idx]>>i) & 0x01)) + HGOTO_DONE(8*idx+i - base); } } size -= 8; @@ -389,16 +385,15 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* End */ if (size>0) { for (iu=offset+size; iu>offset; --iu) { - if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - HRETURN(8*idx+(ssize_t)(iu-1) - base); - } + if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) + HGOTO_DONE(8*idx+(ssize_t)(iu-1) - base); } } break; } - - FUNC_LEAVE(-1); +done: + FUNC_LEAVE(ret_value); } |