diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-03 20:03:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-03 20:03:09 (GMT) |
commit | 7cac82cf682a8358582dd6f995a018f7a6d1a477 (patch) | |
tree | 48b12feeeb4ac23037b8cb5d09b99557fc58b067 /src/H5T.c | |
parent | 153444fed7bd9dfb2b7d90a47c79d11bd1188e96 (diff) | |
download | hdf5-7cac82cf682a8358582dd6f995a018f7a6d1a477.zip hdf5-7cac82cf682a8358582dd6f995a018f7a6d1a477.tar.gz hdf5-7cac82cf682a8358582dd6f995a018f7a6d1a477.tar.bz2 |
[svn-r8801] Purpose:
Code optimization
Description:
Set up datatype ID for dataset's datatype on disk. This allows us to avoid
repeatedly copying the datatype when an ID is needed.
Also, clean up a few warnings in various other places.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.10 (sleipnir) w/parallel
Too minor to require h5committest
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 53 |
1 files changed, 48 insertions, 5 deletions
@@ -470,11 +470,11 @@ H5T_init(void) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5T_init,FAIL); + FUNC_ENTER_NOAPI(H5T_init, FAIL); /* FUNC_ENTER() does all the work */ done: - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(ret_value); } @@ -2875,12 +2875,14 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) case H5T_COPY_REOPEN: /* * Return a transient type (locked or unlocked) or an opened named - * type. + * type. Immutable transient types are degraded to read-only. */ if (H5F_addr_defined(new_dt->ent.header)) { if (H5O_open (&(new_dt->ent))<0) HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type"); new_dt->state = H5T_STATE_OPEN; + } else if (H5T_STATE_IMMUTABLE==new_dt->state) { + new_dt->state = H5T_STATE_RDONLY; } break; } /* end switch */ @@ -4203,7 +4205,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_is_immutable(H5T_t *dt) +H5T_is_immutable(const H5T_t *dt) { htri_t ret_value = FALSE; @@ -4236,7 +4238,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_is_named(H5T_t *dt) +H5T_is_named(const H5T_t *dt) { htri_t ret_value = FALSE; @@ -4488,6 +4490,47 @@ done: /*------------------------------------------------------------------------- + * Function: H5T_is_relocatable + * + * Purpose: Check if a datatype will change between disk and memory. + * + * Notes: Currently, only variable-length and object references change + * between disk & memory (see cases where things are changed in + * the H5T_set_loc() code above). + * + * Return: + * One of two values on success: + * TRUE - If the location of any vlen types changed + * FALSE - If the location of any vlen types is the same + * <0 is returned on failure + * + * Programmer: Quincey Koziol + * Thursday, June 24, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +htri_t +H5T_is_relocatable(const H5T_t *dt) +{ + htri_t ret_value = FALSE; + + FUNC_ENTER_NOAPI(H5T_is_relocatable, FAIL); + + assert(dt); + + if(H5T_detect_class(dt, H5T_VLEN)) + ret_value = TRUE; + else if(H5T_detect_class(dt, H5T_REFERENCE)) + ret_value = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5T_is_relocatable() */ + + +/*------------------------------------------------------------------------- * Function: H5T_print_stats * * Purpose: Print statistics about a conversion path. Statistics are |