summaryrefslogtreecommitdiffstats
path: root/hl/src/H5PT.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-07-30 20:56:40 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-07-30 20:56:40 (GMT)
commite8c162613b75fb3b269830defa769728f439db72 (patch)
tree7c02108c8d1012fb7e8a2b54c5503a5c2f5c019c /hl/src/H5PT.c
parentff1a9ae0e74ded0274729313ba24df578ffaf678 (diff)
downloadhdf5-e8c162613b75fb3b269830defa769728f439db72.zip
hdf5-e8c162613b75fb3b269830defa769728f439db72.tar.gz
hdf5-e8c162613b75fb3b269830defa769728f439db72.tar.bz2
[svn-r25497] Description:
Merge changes that correspond to the 64-bit ID changes (without the actual switch to 64-bit IDs) to the 1.8 release branch. (Plus a few minor cleanups and alignments with the trunk that aren't on the branch) Tested on: Mac OSX/64 10.9.4 (amazon) w/C++ & FORTRAN (h5committested on branch already for a week)
Diffstat (limited to 'hl/src/H5PT.c')
-rw-r--r--hl/src/H5PT.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index ff4347a..d3a03cd 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -13,9 +13,10 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdlib.h>
+
#include "H5PTprivate.h"
#include "H5TBprivate.h"
-#include <stdlib.h>
/* Packet Table private data */
@@ -33,6 +34,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT;
#define H5PT_HASH_TABLE_SIZE 64
/* Packet Table private functions */
+static herr_t H5PT_free_id(void *id);
static herr_t H5PT_close( htbl_t* table );
static herr_t H5PT_create_index(htbl_t *table_id);
static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index);
@@ -84,11 +86,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if(H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
goto out;
/* Get memory for the table identifier */
- table = (htbl_t *)malloc(sizeof(htbl_t));
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
/* Create a simple data space with unlimited size */
dims[0] = 0;
@@ -142,7 +144,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
H5Pclose(plist_id);
H5Dclose(dset_id);
if(table)
- free(table);
+ HDfree(table);
H5E_END_TRY
return H5I_INVALID_HID;
}
@@ -232,10 +234,10 @@ hid_t H5PTopen( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if( H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
goto out;
- table = (htbl_t *)malloc(sizeof(htbl_t));
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
if ( table == NULL ) {
goto out;
@@ -291,12 +293,26 @@ out:
{
H5Dclose(table->dset_id);
H5Tclose(table->type_id);
- free(table);
+ HDfree(table);
}
H5E_END_TRY
return H5I_INVALID_HID;
}
+/*-------------------------------------------------------------------------
+ * Function: H5PT_free_id
+ *
+ * Purpose: Free an id. Callback for H5Iregister_type.
+ *
+ * Return: Success: 0, Failure: N/A
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5PT_free_id(void *id)
+{
+ HDfree(id);
+ return 0;
+}
/*-------------------------------------------------------------------------
* Function: H5PT_close
@@ -331,7 +347,7 @@ H5PT_close( htbl_t* table)
if(H5Tclose(table->type_id) < 0)
goto out;
- free(table);
+ HDfree(table);
return 0;
@@ -342,7 +358,7 @@ out:
H5Dclose(table->dset_id);
H5Tclose(table->type_id);
H5E_END_TRY
- free(table);
+ HDfree(table);
}
return -1;
}
@@ -371,7 +387,7 @@ herr_t H5PTclose( hid_t table_id )
htbl_t * table;
/* Remove the ID from the library */
- if((table = H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL)
+ if((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL)
goto out;
/* If the library found the table, remove it */