summaryrefslogtreecommitdiffstats
path: root/src/H5SL.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-12-30 14:27:29 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-12-30 14:27:29 (GMT)
commit11631664fd46f16acdee324a07851f47480db0c9 (patch)
tree90faca92d82b1231f65c29b80273a182043d0f13 /src/H5SL.c
parent427ff7da2848042f68ecfadf5a321b1d8077e9db (diff)
downloadhdf5-11631664fd46f16acdee324a07851f47480db0c9.zip
hdf5-11631664fd46f16acdee324a07851f47480db0c9.tar.gz
hdf5-11631664fd46f16acdee324a07851f47480db0c9.tar.bz2
[svn-r9730] Purpose:
Code cleanup (sorta) Description: Transition the generic property list code from using the threaded, balanced binary tree code (H5TB<foo>() routines) to use skip lists (H5SL<foo>() routines) for internal management of properties, etc. Platforms tested: FreeBSD 4.10 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'src/H5SL.c')
-rw-r--r--src/H5SL.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/H5SL.c b/src/H5SL.c
index ab9764e..1100a49 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -27,6 +27,11 @@
* actual 'forward' pointer to update, instead of the node
* containing the forward pointer -QAK)
*
+ * (Note: This implementation does not have the information for
+ * implementing the "Linear List Operations" (like insert/delete/
+ * search by position) in section 3.4 of "A Skip List Cookbook",
+ * but they shouldn't be that hard to add, if necessary)
+ *
*/
/* Interface initialization */
@@ -47,7 +52,7 @@
/* Define the code template for insertions for the "OP" in the H5SL_FIND macro */
#define H5SL_FIND_INSERT_FOUND(SLIST,X,UPDATE,I,ITEM) \
- HGOTO_DONE(FAIL);
+ HGOTO_ERROR(H5E_SLIST,H5E_CANTINSERT,FAIL,"can't insert duplicate key");
/* Define the code template for removals for the "OP" in the H5SL_FIND macro */
#define H5SL_FIND_REMOVE_FOUND(SLIST,X,UPDATE,I,ITEM) \
@@ -82,7 +87,7 @@
/* Define a code template for comparing string keys for the "CMP" in the H5SL_FIND macro */
#define H5SL_FIND_STRING_CMP(TYPE,PKEY1,PKEY2) \
- (HDstrcmp(*(TYPE *)PKEY1,*(TYPE *)PKEY2)<0)
+ (HDstrcmp(PKEY1,PKEY2)<0)
/* Define a code template for comparing scalar keys for the "EQ" in the H5SL_FIND macro */
#define H5SL_FIND_SCALAR_EQ(TYPE,PKEY1,PKEY2) \
@@ -90,7 +95,7 @@
/* Define a code template for comparing string keys for the "EQ" in the H5SL_FIND macro */
#define H5SL_FIND_STRING_EQ(TYPE,PKEY1,PKEY2) \
- (HDstrcmp(*(TYPE *)PKEY1,*(TYPE *)PKEY2)==0)
+ (HDstrcmp(PKEY1,PKEY2)==0)
/* Macro used to find node for operation */
#define H5SL_FIND(OP,DOUPDATE,CMP,SLIST,X,UPDATE,I,TYPE,ITEM,KEY,CHECKED) \
@@ -492,7 +497,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
void *
-H5SL_search(H5SL_t *slist, void *key)
+H5SL_search(H5SL_t *slist, const void *key)
{
H5SL_node_t *checked; /* Pointer to last node checked */
H5SL_node_t *x; /* Current node to examine */
@@ -516,11 +521,11 @@ H5SL_search(H5SL_t *slist, void *key)
x=slist->header;
switch(slist->type) {
case H5SL_TYPE_INT:
- H5SL_SEARCH(SCALAR,slist,x,-,i,int,-,key,checked)
+ H5SL_SEARCH(SCALAR,slist,x,-,i,const int,-,key,checked)
break;
case H5SL_TYPE_HADDR:
- H5SL_SEARCH(SCALAR,slist,x,-,i,haddr_t,-,key,checked)
+ H5SL_SEARCH(SCALAR,slist,x,-,i,const haddr_t,-,key,checked)
break;
case H5SL_TYPE_STR:
@@ -556,7 +561,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
void *
-H5SL_remove(H5SL_t *slist, void *key)
+H5SL_remove(H5SL_t *slist, const void *key)
{
H5SL_node_t **update[H5SL_LEVEL_MAX]; /* 'update' vector */
H5SL_node_t *checked; /* Pointer to last node checked */