From 0db364390b48d705b2c3fb225651ba35a19a5b4d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 27 Oct 2004 12:07:41 -0500 Subject: [svn-r9469] Purpose: Code cleanup Description: Clear up some inconsistencies, inefficiencies and possible errors between the release and development branch. Platforms tested: FreeBSD 4.10 (sleipnir) w/parallel Solaris 2.7 (arabica) Linux 2.4 (heping) w/C++ & FORTRAN --- src/H5Odtype.c | 6 ------ src/H5T.c | 8 ++------ src/H5Tarray.c | 6 +++--- src/H5Tcommit.c | 8 ++++---- src/H5Tcompound.c | 4 ++-- src/H5Tenum.c | 3 +-- src/H5Tpkg.h | 6 +++--- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 807aaf3..4aee2b9 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -382,10 +382,6 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) /* Decode base type of VL information */ if (NULL==(dt->shared->parent = H5FL_CALLOC(H5T_t))) HGOTO_ERROR (H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if(NULL== (dt->shared->parent->shared = H5FL_CALLOC (H5T_shared_t))) { - H5FL_FREE(H5T_t, dt->shared->parent); - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - } if (NULL==(dt->shared->parent->shared = H5FL_CALLOC(H5T_shared_t))) { H5FL_FREE(H5T_t, dt->shared->parent); @@ -863,8 +859,6 @@ H5O_dtype_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, if (NULL==(dt->shared=H5FL_CALLOC(H5T_shared_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); dt->ent.header = HADDR_UNDEF; - dt->shared->fo_count=1; - if (H5O_dtype_decode_helper(f, &p, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type"); diff --git a/src/H5T.c b/src/H5T.c index 0c85c3f..f0adf12 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -34,7 +34,7 @@ #include "H5Eprivate.h" /*error handling */ #include "H5Fpkg.h" /* File */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ +#include "H5FOprivate.h" /* File objects */ #include "H5Gprivate.h" /*groups */ #include "H5Iprivate.h" /*ID functions */ #include "H5MMprivate.h" /*memory management */ @@ -443,7 +443,6 @@ static H5T_t *H5T_decode(const unsigned char *buf); H5FL_FREE(H5T_t, dt); \ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \ } \ - dt->shared->fo_count=1; \ } @@ -2855,7 +2854,6 @@ H5T_create(H5T_class_t type, size_t size) } dt->ent.header = HADDR_UNDEF; - dt->shared->fo_count = 1; dt->shared->size = size; /* Set return value */ @@ -2974,9 +2972,8 @@ H5T_open (H5G_entry_t *ent, hid_t dxpl_id) done: if(ret_value==NULL) { if(dt) { - if(shared_fo==NULL) { /* Need to free shared fo */ + if(shared_fo==NULL) /* Need to free shared fo */ H5FL_FREE(H5T_shared_t, dt->shared); - } H5FL_FREE(H5T_t, dt); } if(shared_fo) @@ -3095,7 +3092,6 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) /* Copy actual information */ new_dt->ent = old_dt->ent; *(new_dt->shared) = *(old_dt->shared); - new_dt->shared->fo_count = 1; /* Copy parent information */ if (new_dt->shared->parent) diff --git a/src/H5Tarray.c b/src/H5Tarray.c index 6ee0651..73675a7 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -27,9 +27,9 @@ #define PABLO_MASK H5T_array_mask #include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ /* Declare extern the free list for H5T_t's */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 5853d16..a3b5c80 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -27,10 +27,10 @@ #define PABLO_MASK H5T_commit_mask #include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Tpkg.h" /* Datatypes */ /* Static local functions */ diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index f29342f..48feb6c 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -316,14 +316,14 @@ done: *------------------------------------------------------------------------- */ size_t -H5T_get_member_size(H5T_t *dt, int membno) +H5T_get_member_size(H5T_t *dt, unsigned membno) { size_t ret_value = 0; FUNC_ENTER_NOAPI(H5T_get_member_size, 0); assert(dt); - assert(membno >=0 && membno < dt->shared->u.compnd.nmembs); + assert(membno < dt->shared->u.compnd.nmembs); /* Value */ ret_value = dt->shared->u.compnd.memb[membno].type->shared->size; diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 3f8528d..83a3615 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -28,7 +28,7 @@ #include "H5private.h" /*generic functions */ #include "H5Eprivate.h" /*error handling */ -#include "H5FLprivate.h" /*Free Lists */ +#include "H5FLprivate.h" /*Free Lists */ #include "H5Iprivate.h" /*ID functions */ #include "H5MMprivate.h" /*memory management */ #include "H5Tpkg.h" /*data-type functions */ @@ -592,4 +592,3 @@ H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/) done: FUNC_LEAVE_NOAPI(ret_value) } - diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index f1c71c9..bde3403 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -161,7 +161,7 @@ typedef enum { /* A VL datatype */ typedef struct H5T_vlen_t { H5T_vlen_type_t type; /* Type of VL data in buffer */ - H5T_loc_t loc; /* Location of VL data in buffer */ + H5T_loc_t loc; /* Location of VL data in buffer */ H5T_cset_t cset; /* For VL string. character set */ H5T_str_t pad; /* For VL string. space or null padding of * extra bytes */ @@ -197,7 +197,7 @@ typedef enum H5T_state_t { /* This struct is shared between all occurances of an open named type */ typedef struct H5T_shared_t { - hsize_t fo_count; /* number of references to this file object */ + hsize_t fo_count; /* number of references to this file object */ H5T_state_t state; /*current state of the type */ H5F_t *sh_file;/*file pointer if this is a shared type */ H5T_class_t type; /*which class of type is this? */ @@ -1091,7 +1091,7 @@ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims, /* Compound functions */ H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno); H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); -H5_DLL size_t H5T_get_member_size(H5T_t *dt, int membno); +H5_DLL size_t H5T_get_member_size(H5T_t *dt, unsigned membno); H5_DLL htri_t H5T_is_packed(const H5T_t *dt); #endif -- cgit v0.12