diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-04-10 22:40:07 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-04-10 22:40:07 (GMT) |
commit | ba8f894224240f072c59d18f97abfc344f28f588 (patch) | |
tree | c6e264134b6b6f5100deb465ee4be5f84bd7769c /src/H5I.c | |
parent | 68a140d2cb284dc620306b5a48ea22b49c9dd775 (diff) | |
download | hdf5-ba8f894224240f072c59d18f97abfc344f28f588.zip hdf5-ba8f894224240f072c59d18f97abfc344f28f588.tar.gz hdf5-ba8f894224240f072c59d18f97abfc344f28f588.tar.bz2 |
[svn-r18544] Description:
Allow 'save returned ID structures' mechanism to be toggled per ID type.
Also added initialization of new fields omitted in a previous commit.
Tested:
h5committest, and full check-vfd on linew, amani, and jam.
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -110,6 +110,7 @@ typedef struct { unsigned ids; /*current number of IDs held */ unsigned nextid; /*ID to use for the next atom */ H5I_free_t free_func; /*release object method */ + unsigned reuse_ids; /* whether to reuse returned IDs for this type */ H5I_id_info_t * next_id_ptr; /* pointer to head of available ID list */ H5I_id_info_t **id_list; /*pointer to an array of ptrs to IDs */ } H5I_id_type_t; @@ -355,9 +356,18 @@ H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, type_ptr->ids = 0; type_ptr->nextid = reserved; type_ptr->free_func = free_func; + type_ptr->next_id_ptr = NULL; type_ptr->id_list = (H5I_id_info_t **)H5MM_calloc(hash_size * sizeof(H5I_id_info_t *)); if(NULL == type_ptr->id_list) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed") + + /* Don't re-use IDs for property lists, as this causes problems + * with some virtual file drivers. */ + if (type_id == H5I_GENPROP_LST) + type_ptr->reuse_ids = FALSE; + else + type_ptr->reuse_ids = TRUE; + } /* end if */ /* Increment the count of the times this type has been initialized */ @@ -1318,8 +1328,9 @@ H5I_remove(hid_t id) /* (Casting away const OK -QAK) */ ret_value = (void *)curr_id->obj_ptr; - /* If there's room, save the struct (and its ID) for future re-use */ - if (type_ptr->free_count < MAX_FREE_ID_STRUCTS) { + /* If there's room, and we can save IDs of this type, then + save the struct (and its ID) for future re-use */ + if ((type_ptr->reuse_ids)&&(type_ptr->free_count < MAX_FREE_ID_STRUCTS)) { curr_id->next = type_ptr->next_id_ptr; type_ptr->next_id_ptr = curr_id; type_ptr->free_count++; |