From: Hallvard Furuseth Date: Sat, 14 Dec 2002 22:25:52 +0000 (+0000) Subject: Remove casts of AVL function pointers. X-Git-Tag: NO_SLAP_OP_BLOCKS~678 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2bcb48361dd8cdda534dab96368a4ab8bbcd3131;p=openldap Remove casts of AVL function pointers. --- diff --git a/libraries/libavl/testavl.c b/libraries/libavl/testavl.c index 55c1f2279f..b76d1ba1d5 100644 --- a/libraries/libavl/testavl.c +++ b/libraries/libavl/testavl.c @@ -18,6 +18,7 @@ static void ravl_print LDAP_P(( Avlnode *root, int depth )); static void myprint LDAP_P(( Avlnode *root )); +static int avl_strcmp LDAP_P(( const void *s, const void *t )); int main( int argc, char **argv ) @@ -54,7 +55,7 @@ main( int argc, char **argv ) if ( fgets( name, sizeof( name ), stdin ) == NULL ) exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; - if ( (p = (char *) avl_find( tree, name, (AVL_CMP) strcmp )) + if ( (p = (char *) avl_find( tree, name, avl_strcmp )) == NULL ) printf( "Not found.\n\n" ); else @@ -65,7 +66,7 @@ main( int argc, char **argv ) if ( fgets( name, sizeof( name ), stdin ) == NULL ) exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; - if ( avl_insert( &tree, strdup( name ), (AVL_CMP) strcmp, + if ( avl_insert( &tree, strdup( name ), avl_strcmp, avl_dup_error ) != 0 ) printf( "\nNot inserted!\n" ); break; @@ -74,7 +75,7 @@ main( int argc, char **argv ) if ( fgets( name, sizeof( name ), stdin ) == NULL ) exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; - if ( avl_delete( &tree, name, (AVL_CMP) strcmp ) == NULL ) + if ( avl_delete( &tree, name, avl_strcmp ) == NULL ) printf( "\nNot found!\n" ); break; case 'q': /* quit */ @@ -119,3 +120,8 @@ static void myprint( Avlnode *root ) printf( "********\n" ); } + +static int avl_strcmp( const void *s, const void *t ) +{ + return strcmp( s, t ); +} diff --git a/libraries/librewrite/var.c b/libraries/librewrite/var.c index d4d28ad4b1..941e54b426 100644 --- a/libraries/librewrite/var.c +++ b/libraries/librewrite/var.c @@ -173,9 +173,10 @@ rewrite_var_set( */ static void rewrite_var_free( - struct rewrite_var *var + void *v_var ) { + struct rewrite_var *var = v_var; assert( var != NULL ); assert( var->lv_name != NULL ); @@ -193,7 +194,7 @@ rewrite_var_delete( Avlnode *tree ) { - avl_free( tree, ( AVL_FREE )rewrite_var_free ); + avl_free( tree, rewrite_var_free ); return REWRITE_SUCCESS; } diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 27facafff5..6851b7267a 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -53,10 +53,12 @@ static AttributeType *attr_list = NULL; static int attr_index_cmp( - struct aindexrec *air1, - struct aindexrec *air2 + const void *v_air1, + const void *v_air2 ) { + const struct aindexrec *air1 = v_air1; + const struct aindexrec *air2 = v_air2; int i = air1->air_name.bv_len - air2->air_name.bv_len; if (i) return i; @@ -65,10 +67,12 @@ attr_index_cmp( static int attr_index_name_cmp( - struct berval *type, - struct aindexrec *air + const void *v_type, + const void *v_air ) { + const struct berval *type = v_type; + const struct aindexrec *air = v_air; int i = type->bv_len - air->air_name.bv_len; if (i) return i; @@ -96,8 +100,7 @@ at_bvfind( { struct aindexrec *air; - air = (struct aindexrec *) avl_find( attr_index, name, - (AVL_CMP) attr_index_name_cmp ); + air = avl_find( attr_index, name, attr_index_name_cmp ); return air != NULL ? air->air_at : NULL; } @@ -267,8 +270,7 @@ at_insert( air->air_name.bv_len = strlen(sat->sat_oid); air->air_at = sat; if ( avl_insert( &attr_index, (caddr_t) air, - (AVL_CMP) attr_index_cmp, - (AVL_DUP) avl_dup_error ) ) { + attr_index_cmp, avl_dup_error ) ) { *err = sat->sat_oid; ldap_memfree(air); return SLAP_SCHERR_ATTR_DUP; @@ -285,8 +287,7 @@ at_insert( air->air_name.bv_len = strlen(*names); air->air_at = sat; if ( avl_insert( &attr_index, (caddr_t) air, - (AVL_CMP) attr_index_cmp, - (AVL_DUP) avl_dup_error ) ) { + attr_index_cmp, avl_dup_error ) ) { *err = *names; ldap_memfree(air); return SLAP_SCHERR_ATTR_DUP; @@ -567,9 +568,9 @@ at_add( #ifdef LDAP_DEBUG static int -at_index_printnode( struct aindexrec *air ) +at_index_printnode( void *v_air, void *ignore ) { - + struct aindexrec *air = v_air; printf("%s = %s\n", air->air_name.bv_val, ldap_attributetype2str(&air->air_at->sat_atype) ); @@ -580,8 +581,7 @@ static void at_index_print( void ) { printf("Printing attribute type index:\n"); - (void) avl_apply( attr_index, (AVL_APPLY) at_index_printnode, - 0, -1, AVL_INORDER ); + (void) avl_apply( attr_index, at_index_printnode, 0, -1, AVL_INORDER ); } #endif diff --git a/servers/slapd/back-bdb/attr.c b/servers/slapd/back-bdb/attr.c index 07bfc92cab..38e6e974f6 100644 --- a/servers/slapd/back-bdb/attr.c +++ b/servers/slapd/back-bdb/attr.c @@ -23,19 +23,22 @@ typedef struct bdb_attrinfo { static int ainfo_type_cmp( - AttributeDescription *desc, - AttrInfo *a + const void *v_desc, + const void *v_a ) { + const AttributeDescription *desc = v_desc; + const AttrInfo *a = v_a; return desc - a->ai_desc; } static int ainfo_cmp( - AttrInfo *a, - AttrInfo *b + const void *v_a, + const void *v_b ) { + const AttrInfo *a = v_a, *b = v_b; return a->ai_desc - b->ai_desc; } @@ -47,8 +50,7 @@ bdb_attr_mask( { AttrInfo *a; - a = (AttrInfo *) avl_find( bdb->bi_attrs, desc, - (AVL_CMP) ainfo_type_cmp ); + a = (AttrInfo *) avl_find( bdb->bi_attrs, desc, ainfo_type_cmp ); *indexmask = a != NULL ? a->ai_indexmask : 0; } @@ -194,7 +196,7 @@ bdb_attr_index_config( a->ai_indexmask = mask; rc = avl_insert( &bdb->bi_attrs, (caddr_t) a, - (AVL_CMP) ainfo_cmp, (AVL_DUP) avl_dup_error ); + ainfo_cmp, avl_dup_error ); if( rc ) { fprintf( stderr, "%s: line %d: duplicate index definition " diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index ab0cec701c..3428348dff 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -491,7 +491,7 @@ bdb_cache_add_entry_rw( } if ( avl_insert( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { /* free cache write lock */ ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock ); @@ -513,7 +513,7 @@ bdb_cache_add_entry_rw( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -527,7 +527,7 @@ bdb_cache_add_entry_rw( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, @@ -554,7 +554,7 @@ bdb_cache_add_entry_rw( case DB_LOCK_NOTGRANTED : /* undo avl changes immediately */ if ( avl_delete( &cache->c_idtree, (caddr_t) e, - (AVL_CMP) entry_id_cmp ) == NULL ) { + entry_id_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, "bdb_cache_add_entry: can't delete (%s) from cache.\n", @@ -564,7 +564,7 @@ bdb_cache_add_entry_rw( #endif } if ( avl_delete( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp ) == NULL ) { + entry_dn_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, "bdb_cache_add_entry: can't delete (%s) from cache.\n", @@ -653,7 +653,7 @@ bdb_cache_update_entry( assert( e->e_private ); if ( avl_insert( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -672,7 +672,7 @@ bdb_cache_update_entry( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -686,7 +686,7 @@ bdb_cache_update_entry( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, @@ -774,7 +774,7 @@ try_again: ldap_pvt_thread_rdwr_rlock( &cache->c_rwlock ); if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e, - (AVL_CMP) entry_dn_cmp )) != NULL ) + entry_dn_cmp )) != NULL ) { int state; count++; @@ -874,7 +874,7 @@ try_again: ldap_pvt_thread_rdwr_rlock( &cache->c_rwlock ); if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e, - (AVL_CMP) entry_id_cmp )) != NULL ) + entry_id_cmp )) != NULL ) { int state; ID ep_id; @@ -1029,15 +1029,13 @@ bdb_cache_delete_entry_internal( int rc = 0; /* return code */ /* dn tree */ - if ( avl_delete( &cache->c_dntree, (caddr_t) e, (AVL_CMP) entry_dn_cmp ) - == NULL ) + if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp ) == NULL ) { rc = -1; } /* id tree */ - if ( avl_delete( &cache->c_idtree, (caddr_t) e, (AVL_CMP) entry_id_cmp ) - == NULL ) + if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp ) == NULL ) { rc = -1; } diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index eb3600c940..28f81f92cc 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -622,28 +622,32 @@ node_find_cmp( static int node_frdn_cmp( - struct berval *nrdn, - idNode *n + const void *v_nrdn, + const void *v_n ) { + const struct berval *nrdn = v_nrdn; + const idNode *n = v_n; return ber_bvcmp(nrdn, &n->i_rdn->nrdn); } static int node_add_cmp( - idNode *a, - idNode *b + const void *v_a, + const void *v_b ) { + const idNode *a = v_a, *b = v_b; return a->i_id - b->i_id; } static int node_rdn_cmp( - idNode *a, - idNode *b + const void *v_a, + const void *v_b ) { + const idNode *a = v_a, *b = v_b; /* should be slightly better without ordering drawbacks */ return ber_bvcmp(&a->i_rdn->nrdn, &b->i_rdn->nrdn); } @@ -661,15 +665,17 @@ idNode * bdb_find_rdn_node( Avlnode *tree ) { - return avl_find(tree, (const void *)nrdn, (AVL_CMP)node_frdn_cmp); + return avl_find(tree, nrdn, node_frdn_cmp); } /* This function links a node into its parent's i_kids tree. */ -int bdb_insert_kid( - idNode *a, - Avlnode *tree +static int bdb_insert_kid( + void *v_a, + void *v_tree ) { + idNode *a = v_a; + Avlnode *tree = v_tree; int rc; if (a->i_rdn->parent == 0) @@ -679,7 +685,7 @@ int bdb_insert_kid( return -1; ldap_pvt_thread_rdwr_wlock(&a->i_parent->i_kids_rdwr); rc = avl_insert( &a->i_parent->i_kids, (caddr_t) a, - (AVL_CMP)node_rdn_cmp, (AVL_DUP) avl_dup_error ); + node_rdn_cmp, avl_dup_error ); ldap_pvt_thread_rdwr_wunlock(&a->i_parent->i_kids_rdwr); return rc; } @@ -701,8 +707,7 @@ idNode *bdb_add_node( node->i_rdn->rdn.bv_val += (long)d; node->i_rdn->nrdn.bv_val += (long)d; ldap_pvt_thread_rdwr_init(&node->i_kids_rdwr); - avl_insert( &bdb->bi_tree, (caddr_t) node, - (AVL_CMP)node_add_cmp, (AVL_DUP) avl_dup_error ); + avl_insert( &bdb->bi_tree, (caddr_t) node, node_add_cmp, avl_dup_error ); if (id == 1) bdb->bi_troot = node; return node; @@ -741,7 +746,7 @@ int bdb_build_tree( } cursor->c_close( cursor ); - rc = avl_apply(bdb->bi_tree, (AVL_APPLY)bdb_insert_kid, bdb->bi_tree, + rc = avl_apply(bdb->bi_tree, bdb_insert_kid, bdb->bi_tree, -1, AVL_INORDER ); return rc; @@ -880,8 +885,7 @@ bdb_dn2id_delete( if (n) { if (n->i_parent) { ldap_pvt_thread_rdwr_wlock(&n->i_parent->i_kids_rdwr); - avl_delete(&n->i_parent->i_kids, &n->i_rdn->nrdn, - (AVL_CMP)node_frdn_cmp); + avl_delete(&n->i_parent->i_kids, &n->i_rdn->nrdn, node_frdn_cmp); ldap_pvt_thread_rdwr_wunlock(&n->i_parent->i_kids_rdwr); } free(n->i_rdn); @@ -986,26 +990,29 @@ bdb_dn2id_children( */ static int insert_one( - idNode *n, - ID *ids + void *v_n, + void *v_ids ) { + idNode *n = v_n; + ID *ids = v_ids; return bdb_idl_insert(ids, n->i_id); } static int insert_sub( - idNode *n, - ID *ids + void *v_n, + void *v_ids ) { + idNode *n = v_n; + ID *ids = v_ids; int rc; rc = bdb_idl_insert(ids, n->i_id); if (rc == 0) { ldap_pvt_thread_rdwr_rlock(&n->i_kids_rdwr); - rc = avl_apply(n->i_kids, (AVL_APPLY)insert_sub, ids, -1, - AVL_INORDER); + rc = avl_apply(n->i_kids, insert_sub, ids, -1, AVL_INORDER); ldap_pvt_thread_rdwr_runlock(&n->i_kids_rdwr); } return rc; @@ -1038,11 +1045,9 @@ bdb_dn2idl( ids[0] = 0; ldap_pvt_thread_rdwr_rlock(&n->i_kids_rdwr); if (prefix == DN_ONE_PREFIX) { - rc = avl_apply(n->i_kids, (AVL_APPLY)insert_one, ids, -1, - AVL_INORDER); + rc = avl_apply(n->i_kids, insert_one, ids, -1, AVL_INORDER); } else { - rc = avl_apply(n->i_kids, (AVL_APPLY)insert_sub, ids, -1, - AVL_INORDER); + rc = avl_apply(n->i_kids, insert_sub, ids, -1, AVL_INORDER); } ldap_pvt_thread_rdwr_runlock(&n->i_kids_rdwr); return rc; diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index adc2abbf11..0aa1b6cbb6 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -45,8 +45,9 @@ } while ( 0 ) static int -bdb_idl_entry_cmp( bdb_idl_cache_entry_t* idl1, bdb_idl_cache_entry_t* idl2 ) +bdb_idl_entry_cmp( const void *v_idl1, const void *v_idl2 ) { + const bdb_idl_cache_entry_t *idl1 = v_idl1, *idl2 = v_idl2; int rc; if ((rc = idl1->db - idl2->db )) return rc; @@ -333,7 +334,8 @@ bdb_idl_fetch_key( DBT2bv( key, &idl_tmp.kstr ); idl_tmp.db = db; ldap_pvt_thread_mutex_lock( &bdb->bi_idl_tree_mutex ); - matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, (AVL_CMP) bdb_idl_entry_cmp ); + matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, + bdb_idl_entry_cmp ); if ( matched_idl_entry != NULL ) { BDB_IDL_CPY( ids, matched_idl_entry->idl ); IDL_LRU_DELETE( bdb, matched_idl_entry ); @@ -469,7 +471,8 @@ bdb_idl_fetch_key( BDB_IDL_CPY( ee->idl, ids ); ber_dupbv( &ee->kstr, &idl_tmp.kstr ); ldap_pvt_thread_mutex_lock( &bdb->bi_idl_tree_mutex ); - if ( avl_insert( &bdb->bi_idl_tree, (caddr_t) ee, (AVL_CMP) bdb_idl_entry_cmp, avl_dup_error )) { + if ( avl_insert( &bdb->bi_idl_tree, (caddr_t) ee, + bdb_idl_entry_cmp, avl_dup_error )) { free( ee->kstr.bv_val ); free( ee->idl ); free( ee ); @@ -479,7 +482,8 @@ bdb_idl_fetch_key( int i = 0; while ( bdb->bi_idl_lru_tail != NULL && i < 10 ) { ee = bdb->bi_idl_lru_tail; - avl_delete( &bdb->bi_idl_tree, (caddr_t) ee, (AVL_CMP) bdb_idl_entry_cmp ); + avl_delete( &bdb->bi_idl_tree, (caddr_t) ee, + bdb_idl_entry_cmp ); IDL_LRU_DELETE( bdb, ee ); i++; --bdb->bi_idl_cache_size; @@ -533,9 +537,11 @@ bdb_idl_insert_key( DBT2bv( key, &idl_tmp.kstr ); idl_tmp.db = db; ldap_pvt_thread_mutex_lock( &bdb->bi_idl_tree_mutex ); - matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, (AVL_CMP) bdb_idl_entry_cmp ); + matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, + bdb_idl_entry_cmp ); if ( matched_idl_entry != NULL ) { - avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, (AVL_CMP) bdb_idl_entry_cmp ); + avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, + bdb_idl_entry_cmp ); --bdb->bi_idl_cache_size; IDL_LRU_DELETE( bdb, matched_idl_entry ); free( matched_idl_entry->kstr.bv_val ); @@ -743,9 +749,11 @@ bdb_idl_delete_key( DBT2bv( key, &idl_tmp.kstr ); idl_tmp.db = db; ldap_pvt_thread_mutex_lock( &bdb->bi_idl_tree_mutex ); - matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, (AVL_CMP) bdb_idl_entry_cmp ); + matched_idl_entry = avl_find( bdb->bi_idl_tree, &idl_tmp, + bdb_idl_entry_cmp ); if ( matched_idl_entry != NULL ) { - avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, (AVL_CMP) bdb_idl_entry_cmp ); + avl_delete( &bdb->bi_idl_tree, (caddr_t) matched_idl_entry, + bdb_idl_entry_cmp ); --bdb->bi_idl_cache_size; IDL_LRU_DELETE( bdb, matched_idl_entry ); free( matched_idl_entry->kstr.bv_val ); diff --git a/servers/slapd/back-ldap/back-ldap.h b/servers/slapd/back-ldap/back-ldap.h index 3145ddd881..ff9b9f33d5 100644 --- a/servers/slapd/back-ldap/back-ldap.h +++ b/servers/slapd/back-ldap/back-ldap.h @@ -120,7 +120,7 @@ ldap_back_map_attrs( int remap ); -extern void mapping_free ( struct ldapmapping *mapping ); +extern void mapping_free ( void *mapping ); #ifdef ENABLE_REWRITE extern int suffix_massage_config( struct rewrite_info *info, diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index 6cc3078363..0670013157 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -131,9 +131,10 @@ ldap_back_db_init( static void conn_free( - struct ldapconn *lc + void *v_lc ) { + struct ldapconn *lc = v_lc; ldap_unbind( lc->ld ); if ( lc->bound_dn.bv_val ) { ch_free( lc->bound_dn.bv_val ); @@ -145,8 +146,9 @@ conn_free( } void -mapping_free ( struct ldapmapping *mapping ) +mapping_free( void *v_mapping ) { + struct ldapmapping *mapping = v_mapping; ch_free( mapping->src.bv_val ); ch_free( mapping->dst.bv_val ); ch_free( mapping ); @@ -177,7 +179,7 @@ ldap_back_db_destroy( li->bindpw = NULL; } if (li->conntree) { - avl_free( li->conntree, (AVL_FREE) conn_free ); + avl_free( li->conntree, conn_free ); } #ifdef ENABLE_REWRITE if (li->rwinfo) { @@ -190,9 +192,9 @@ ldap_back_db_destroy( #endif /* !ENABLE_REWRITE */ avl_free( li->oc_map.remap, NULL ); - avl_free( li->oc_map.map, (AVL_FREE) mapping_free ); + avl_free( li->oc_map.map, mapping_free ); avl_free( li->at_map.remap, NULL ); - avl_free( li->at_map.map, (AVL_FREE) mapping_free ); + avl_free( li->at_map.map, mapping_free ); ldap_pvt_thread_mutex_unlock( &li->conn_mutex ); ldap_pvt_thread_mutex_destroy( &li->conn_mutex ); diff --git a/servers/slapd/back-ldbm/attr.c b/servers/slapd/back-ldbm/attr.c index 47022cfe40..dbb1389b8a 100644 --- a/servers/slapd/back-ldbm/attr.c +++ b/servers/slapd/back-ldbm/attr.c @@ -23,19 +23,22 @@ typedef struct ldbm_attrinfo { static int ainfo_type_cmp( - AttributeDescription *desc, - AttrInfo *a + const void *v_desc, + const void *v_a ) { + const AttributeDescription *desc = v_desc; + const AttrInfo *a = v_a; return desc - a->ai_desc; } static int ainfo_cmp( - AttrInfo *a, - AttrInfo *b + const void *v_a, + const void *v_b ) { + const AttrInfo *a = v_a, *b = v_b; return a->ai_desc - b->ai_desc; } @@ -47,8 +50,7 @@ attr_mask( { AttrInfo *a; - a = (AttrInfo *) avl_find( li->li_attrs, desc, - (AVL_CMP) ainfo_type_cmp ); + a = avl_find( li->li_attrs, desc, ainfo_type_cmp ); *indexmask = a != NULL ? a->ai_indexmask : 0; } @@ -195,7 +197,7 @@ attr_index_config( a->ai_indexmask = mask; rc = avl_insert( &li->li_attrs, (caddr_t) a, - (AVL_CMP) ainfo_cmp, (AVL_DUP) avl_dup_error ); + ainfo_cmp, avl_dup_error ); if( rc ) { fprintf( stderr, "%s: line %d: duplicate index definition " diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 4a26488a4e..2efe607e1d 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -244,7 +244,7 @@ cache_add_entry_rw( } if ( avl_insert( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { /* free cache mutex */ ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); @@ -266,7 +266,7 @@ cache_add_entry_rw( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -280,7 +280,7 @@ cache_add_entry_rw( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, @@ -368,7 +368,7 @@ cache_update_entry( assert( e->e_private ); if ( avl_insert( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 ) + entry_dn_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -387,7 +387,7 @@ cache_update_entry( /* id tree */ if ( avl_insert( &cache->c_idtree, (caddr_t) e, - (AVL_CMP) entry_id_cmp, avl_dup_error ) != 0 ) + entry_id_cmp, avl_dup_error ) != 0 ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, DETAIL1, @@ -401,7 +401,7 @@ cache_update_entry( /* delete from dn tree inserted above */ if ( avl_delete( &cache->c_dntree, (caddr_t) e, - (AVL_CMP) entry_dn_cmp ) == NULL ) + entry_dn_cmp ) == NULL ) { #ifdef NEW_LOGGING LDAP_LOG( CACHE, INFO, @@ -484,7 +484,7 @@ try_again: ldap_pvt_thread_mutex_lock( &cache->c_mutex ); if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e, - (AVL_CMP) entry_dn_cmp )) != NULL ) + entry_dn_cmp )) != NULL ) { int state; count++; @@ -571,7 +571,7 @@ try_again: ldap_pvt_thread_mutex_lock( &cache->c_mutex ); if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e, - (AVL_CMP) entry_id_cmp )) != NULL ) + entry_id_cmp )) != NULL ) { int state; ID ep_id; @@ -683,15 +683,13 @@ cache_delete_entry_internal( int rc = 0; /* return code */ /* dn tree */ - if ( avl_delete( &cache->c_dntree, (caddr_t) e, (AVL_CMP) entry_dn_cmp ) - == NULL ) + if ( avl_delete( &cache->c_dntree, (caddr_t) e, entry_dn_cmp ) == NULL ) { rc = -1; } /* id tree */ - if ( avl_delete( &cache->c_idtree, (caddr_t) e, (AVL_CMP) entry_id_cmp ) - == NULL ) + if ( avl_delete( &cache->c_idtree, (caddr_t) e, entry_id_cmp ) == NULL ) { rc = -1; } diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index eae98ba6aa..2c7101192e 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -157,9 +157,10 @@ meta_back_db_init( static void conn_free( - struct metaconn *lc + void *v_lc ) { + struct metaconn *lc = v_lc; struct metasingleconn *lsc; for ( lsc = lc->conns; !META_LAST(lsc); lsc++ ) { @@ -205,9 +206,9 @@ target_free( rewrite_info_delete( lt->rwinfo ); } avl_free( lt->oc_map.remap, NULL ); - avl_free( lt->oc_map.map, ( AVL_FREE )mapping_free ); + avl_free( lt->oc_map.map, mapping_free ); avl_free( lt->at_map.remap, NULL ); - avl_free( lt->at_map.map, ( AVL_FREE )mapping_free ); + avl_free( lt->at_map.map, mapping_free ); } int @@ -228,8 +229,7 @@ meta_back_db_destroy( ldap_pvt_thread_mutex_lock( &li->conn_mutex ); if ( li->conntree ) { - avl_free( li->conntree, - ( AVL_FREE )conn_free ); + avl_free( li->conntree, conn_free ); } /* @@ -245,8 +245,7 @@ meta_back_db_destroy( ldap_pvt_thread_mutex_lock( &li->cache.mutex ); if ( li->cache.tree ) { - avl_free( li->cache.tree, - ( AVL_FREE )meta_dncache_free ); + avl_free( li->cache.tree, meta_dncache_free ); } ldap_pvt_thread_mutex_unlock( &li->cache.mutex ); diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index ccc4f1391e..25bef986fb 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -263,9 +263,11 @@ backsql_has_children( return rc; } -int -backsql_get_attr_vals( backsql_at_map_rec *at, backsql_srch_info *bsi ) +static int +backsql_get_attr_vals( void *v_at, void *v_bsi ) { + backsql_at_map_rec *at = v_at; + backsql_srch_info *bsi = v_bsi; RETCODE rc; SQLHSTMT sth; BACKSQL_ROW_NTS row; @@ -403,7 +405,7 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) } else { Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " "retrieving all attributes\n", 0, 0, 0 ); - avl_apply( bsi->oc->attrs, (AVL_APPLY)backsql_get_attr_vals, + avl_apply( bsi->oc->attrs, backsql_get_attr_vals, bsi, 0, AVL_INORDER ); } diff --git a/servers/slapd/back-sql/schema-map.c b/servers/slapd/back-sql/schema-map.c index c78620445f..6244955033 100644 --- a/servers/slapd/back-sql/schema-map.c +++ b/servers/slapd/back-sql/schema-map.c @@ -26,14 +26,16 @@ * Uses the pointer to the ObjectClass structure */ static int -backsql_cmp_oc( backsql_oc_map_rec *m1, backsql_oc_map_rec *m2 ) +backsql_cmp_oc( const void *v_m1, const void *v_m2 ) { + const backsql_oc_map_rec *m1 = v_m1, *m2 = v_m2; return ( m1->oc < m2->oc ? -1 : ( m1->oc > m2->oc ? 1 : 0 ) ); } static int -backsql_cmp_oc_id( backsql_oc_map_rec *m1, backsql_oc_map_rec *m2 ) +backsql_cmp_oc_id( const void *v_m1, const void *v_m2 ) { + const backsql_oc_map_rec *m1 = v_m1, *m2 = v_m2; return ( m1->id < m2->id ? -1 : ( m1->id > m2->id ? 1 : 0 ) ); } @@ -41,8 +43,9 @@ backsql_cmp_oc_id( backsql_oc_map_rec *m1, backsql_oc_map_rec *m2 ) * Uses the pointer to the AttributeDescription structure */ static int -backsql_cmp_attr( backsql_at_map_rec *m1, backsql_at_map_rec *m2 ) +backsql_cmp_attr( const void *v_m1, const void *v_m2 ) { + const backsql_at_map_rec *m1 = v_m1, *m2 = v_m2; return ( m1->ad < m2->ad ? -1 : ( m1->ad > m2->ad ? 1 : 0 ) ); } @@ -116,8 +119,7 @@ backsql_add_sysmaps( backsql_oc_map_rec *oc_map ) at_map->param_order = 0; at_map->expect_return = 0; backsql_make_attr_query( oc_map, at_map ); - avl_insert( &oc_map->attrs, at_map, - (AVL_CMP)backsql_cmp_attr, NULL ); + avl_insert( &oc_map->attrs, at_map, backsql_cmp_attr, NULL ); at_map = (backsql_at_map_rec *)ch_calloc( 1, sizeof( backsql_at_map_rec ) ); @@ -145,8 +147,7 @@ backsql_add_sysmaps( backsql_oc_map_rec *oc_map ) at_map->param_order = 0; at_map->expect_return = 0; backsql_make_attr_query( oc_map, at_map ); - avl_insert( &oc_map->attrs, at_map, - (AVL_CMP)backsql_cmp_attr, NULL ); + avl_insert( &oc_map->attrs, at_map, backsql_cmp_attr, NULL ); return 1; } @@ -259,10 +260,8 @@ backsql_load_schema_map( backsql_info *si, SQLHDBC dbh ) */ oc_map->attrs = NULL; - avl_insert( &si->oc_by_oc, oc_map, - (AVL_CMP)backsql_cmp_oc, NULL ); - avl_insert( &si->oc_by_id, oc_map, - (AVL_CMP)backsql_cmp_oc_id, NULL ); + avl_insert( &si->oc_by_oc, oc_map, backsql_cmp_oc, NULL ); + avl_insert( &si->oc_by_id, oc_map, backsql_cmp_oc_id, NULL ); oc_id = oc_map->id; Debug( LDAP_DEBUG_TRACE, "load_schema_map(): " "objectClass '%s': keytbl='%s' keycol='%s'\n", @@ -367,8 +366,7 @@ backsql_load_schema_map( backsql_info *si, SQLHDBC dbh ) Debug( LDAP_DEBUG_TRACE, "load_schema_map(): " "preconstructed query '%s'\n", at_map->query, 0, 0 ); - avl_insert( &oc_map->attrs, at_map, - (AVL_CMP)backsql_cmp_attr, NULL ); + avl_insert( &oc_map->attrs, at_map, backsql_cmp_attr, NULL ); } backsql_FreeRow( &at_row ); SQLFreeStmt( at_sth, SQL_CLOSE ); @@ -393,8 +391,7 @@ backsql_oc2oc( backsql_info *si, ObjectClass *oc ) #endif /* BACKSQL_TRACE */ tmp.oc = oc; - res = (backsql_oc_map_rec *)avl_find( si->oc_by_oc, &tmp, - (AVL_CMP)backsql_cmp_oc ); + res = (backsql_oc_map_rec *)avl_find( si->oc_by_oc, &tmp, backsql_cmp_oc ); #ifdef BACKSQL_TRACE if ( res != NULL ) { Debug( LDAP_DEBUG_TRACE, "<==backsql_oc2oc(): " @@ -425,8 +422,7 @@ backsql_name2oc( backsql_info *si, struct berval *oc_name ) return NULL; } - res = (backsql_oc_map_rec *)avl_find( si->oc_by_oc, &tmp, - (AVL_CMP)backsql_cmp_oc ); + res = (backsql_oc_map_rec *)avl_find( si->oc_by_oc, &tmp, backsql_cmp_oc ); #ifdef BACKSQL_TRACE if ( res != NULL ) { Debug( LDAP_DEBUG_TRACE, "<==oc_with_name(): " @@ -453,7 +449,7 @@ backsql_id2oc( backsql_info *si, unsigned long id ) tmp.id = id; res = (backsql_oc_map_rec *)avl_find( si->oc_by_id, &tmp, - (AVL_CMP)backsql_cmp_oc_id ); + backsql_cmp_oc_id ); #ifdef BACKSQL_TRACE if ( res != NULL ) { @@ -482,7 +478,7 @@ backsql_ad2at( backsql_oc_map_rec* objclass, AttributeDescription *ad ) tmp.ad = ad; res = (backsql_at_map_rec *)avl_find( objclass->attrs, &tmp, - (AVL_CMP)backsql_cmp_attr ); + backsql_cmp_attr ); #ifdef BACKSQL_TRACE if ( res != NULL ) { @@ -518,7 +514,7 @@ backsql_name2at( backsql_oc_map_rec* objclass, struct berval *attr ) } res = (backsql_at_map_rec *)avl_find( objclass->attrs, &tmp, - (AVL_CMP)backsql_cmp_attr ); + backsql_cmp_attr ); #ifdef BACKSQL_TRACE if ( res != NULL ) { @@ -535,8 +531,9 @@ backsql_name2at( backsql_oc_map_rec* objclass, struct berval *attr ) } static void -backsql_free_attr( backsql_at_map_rec *at ) +backsql_free_attr( void *v_at ) { + backsql_at_map_rec *at = v_at; Debug( LDAP_DEBUG_TRACE, "==>free_attr(): '%s'\n", at->ad->ad_cname.bv_val, 0, 0 ); ch_free( at->sel_expr.bv_val ); @@ -567,11 +564,12 @@ backsql_free_attr( backsql_at_map_rec *at ) } static void -backsql_free_oc( backsql_oc_map_rec *oc ) +backsql_free_oc( void *v_oc ) { + backsql_oc_map_rec *oc = v_oc; Debug( LDAP_DEBUG_TRACE, "==>free_oc(): '%s'\n", BACKSQL_OC_NAME( oc ), 0, 0 ); - avl_free( oc->attrs, (AVL_FREE)backsql_free_attr ); + avl_free( oc->attrs, backsql_free_attr ); ch_free( oc->keytbl.bv_val ); ch_free( oc->keycol.bv_val ); if ( oc->create_proc != NULL ) { @@ -592,8 +590,8 @@ int backsql_destroy_schema_map( backsql_info *si ) { Debug( LDAP_DEBUG_TRACE, "==>destroy_schema_map()\n", 0, 0, 0 ); - avl_free( si->oc_by_oc, NULL ); - avl_free( si->oc_by_id, (AVL_FREE)backsql_free_oc ); + avl_free( si->oc_by_oc, 0 ); + avl_free( si->oc_by_id, backsql_free_oc ); Debug( LDAP_DEBUG_TRACE, "<==destroy_schema_map()\n", 0, 0, 0 ); return 0; } diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index b5fefff7ff..c5f67a8bce 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -799,9 +799,11 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) return ( query->bv_val == NULL ? 1 : 0 ); } -int -backsql_oc_get_candidates( backsql_oc_map_rec *oc, backsql_srch_info *bsi ) +static int +backsql_oc_get_candidates( void *v_oc, void *v_bsi ) { + backsql_oc_map_rec *oc = v_oc; + backsql_srch_info *bsi = v_bsi; struct berval query; SQLHSTMT sth; RETCODE rc; @@ -1128,7 +1130,7 @@ backsql_search( */ srch_info.n_candidates = ( isroot ? -2 : limit->lms_s_unchecked == -1 ? -2 : limit->lms_s_unchecked ); - avl_apply( bi->oc_by_oc, (AVL_APPLY)backsql_oc_get_candidates, + avl_apply( bi->oc_by_oc, backsql_oc_get_candidates, &srch_info, BACKSQL_STOP, AVL_INORDER ); if ( !isroot && limit->lms_s_unchecked != -1 ) { if ( srch_info.n_candidates == -1 ) { diff --git a/servers/slapd/back-sql/sql-wrap.c b/servers/slapd/back-sql/sql-wrap.c index f6d3a81cf4..b86d4da825 100644 --- a/servers/slapd/back-sql/sql-wrap.c +++ b/servers/slapd/back-sql/sql-wrap.c @@ -253,8 +253,9 @@ backsql_FreeRow( BACKSQL_ROW_NTS *row ) } static int -backsql_cmp_connid( backsql_db_conn *c1, backsql_db_conn *c2 ) +backsql_cmp_connid( const void *v_c1, const void *v_c2 ) { + const backsql_db_conn *c1 = v_c1, *c2 = v_c2; if ( c1->ldap_cid > c2->ldap_cid ) { return 1; } @@ -390,7 +391,7 @@ backsql_open_db_conn( backsql_info *si, int ldap_cid, backsql_db_conn **pdbc ) Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(): " "connected, adding to tree\n", 0, 0, 0 ); ldap_pvt_thread_mutex_lock( &si->dbconn_mutex ); - avl_insert( &si->db_conns, dbc, (AVL_CMP)backsql_cmp_connid, NULL ); + avl_insert( &si->db_conns, dbc, backsql_cmp_connid, NULL ); ldap_pvt_thread_mutex_unlock( &si->dbconn_mutex ); Debug( LDAP_DEBUG_TRACE, "<==backsql_open_db_conn()\n", 0, 0, 0 ); @@ -408,8 +409,7 @@ backsql_free_db_conn( Backend *be, Connection *ldapc ) Debug( LDAP_DEBUG_TRACE, "==>backsql_free_db_conn()\n", 0, 0, 0 ); tmp.ldap_cid = ldapc->c_connid; ldap_pvt_thread_mutex_lock( &si->dbconn_mutex ); - conn = (backsql_db_conn *)avl_delete( &si->db_conns, &tmp, - (AVL_CMP)backsql_cmp_connid ); + conn = avl_delete( &si->db_conns, &tmp, backsql_cmp_connid ); ldap_pvt_thread_mutex_unlock( &si->dbconn_mutex ); /* @@ -444,8 +444,7 @@ backsql_get_db_conn( Backend *be, Connection *ldapc, SQLHDBC *dbh ) * we have one thread per connection, as I understand -- * so we do not need locking here */ - dbc = (backsql_db_conn *)avl_find( si->db_conns, &tmp, - (AVL_CMP)backsql_cmp_connid ); + dbc = avl_find( si->db_conns, &tmp, backsql_cmp_connid ); if ( !dbc ) { rc = backsql_open_db_conn( si, ldapc->c_connid, &dbc ); if ( rc != LDAP_SUCCESS) { diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index cef1279c43..184a856139 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.c @@ -28,9 +28,11 @@ static ContentRule *cr_list = NULL; static int cr_index_cmp( - struct cindexrec *cir1, - struct cindexrec *cir2 ) + const void *v_cir1, + const void *v_cir2 ) { + const struct cindexrec *cir1 = v_cir1; + const struct cindexrec *cir2 = v_cir2; int i = cir1->cir_name.bv_len - cir2->cir_name.bv_len; if (i) return i; @@ -39,9 +41,11 @@ cr_index_cmp( static int cr_index_name_cmp( - struct berval *name, - struct cindexrec *cir ) + const void *v_name, + const void *v_cir ) { + const struct berval *name = v_name; + const struct cindexrec *cir = v_cir; int i = name->bv_len - cir->cir_name.bv_len; if (i) return i; @@ -64,8 +68,7 @@ cr_bvfind( struct berval *crname ) { struct cindexrec *cir; - cir = (struct cindexrec *) avl_find( cr_index, crname, - (AVL_CMP) cr_index_name_cmp ); + cir = avl_find( cr_index, crname, cr_index_name_cmp ); if ( cir != NULL ) { return( cir->cir_cr ); @@ -118,8 +121,7 @@ cr_insert( assert( cir->cir_cr ); if ( avl_insert( &cr_index, (caddr_t) cir, - (AVL_CMP) cr_index_cmp, - (AVL_DUP) avl_dup_error ) ) + cr_index_cmp, avl_dup_error ) ) { *err = scr->scr_oid; ldap_memfree(cir); @@ -142,8 +144,7 @@ cr_insert( assert( cir->cir_cr ); if ( avl_insert( &cr_index, (caddr_t) cir, - (AVL_CMP) cr_index_cmp, - (AVL_DUP) avl_dup_error ) ) + cr_index_cmp, avl_dup_error ) ) { *err = *names; ldap_memfree(cir); diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index b07ad02b43..181a2933a1 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -388,17 +388,19 @@ entry_cmp( Entry *e1, Entry *e2 ) } int -entry_dn_cmp( Entry *e1, Entry *e2 ) +entry_dn_cmp( const void *v_e1, const void *v_e2 ) { /* compare their normalized UPPERCASED dn's */ + const Entry *e1 = v_e1, *e2 = v_e2; int rc = e1->e_nname.bv_len - e2->e_nname.bv_len; if (rc) return rc; return( strcmp( e1->e_ndn, e2->e_ndn ) ); } int -entry_id_cmp( Entry *e1, Entry *e2 ) +entry_id_cmp( const void *v_e1, const void *v_e2 ) { + const Entry *e1 = v_e1, *e2 = v_e2; return( e1->e_id < e2->e_id ? -1 : (e1->e_id > e2->e_id ? 1 : 0) ); } diff --git a/servers/slapd/mr.c b/servers/slapd/mr.c index 58e5c960a4..5f6e496f55 100644 --- a/servers/slapd/mr.c +++ b/servers/slapd/mr.c @@ -27,10 +27,12 @@ static MatchingRuleUse *mru_list = NULL; static int mr_index_cmp( - struct mindexrec *mir1, - struct mindexrec *mir2 + const void *v_mir1, + const void *v_mir2 ) { + const struct mindexrec *mir1 = v_mir1; + const struct mindexrec *mir2 = v_mir2; int i = mir1->mir_name.bv_len - mir2->mir_name.bv_len; if (i) return i; return (strcmp( mir1->mir_name.bv_val, mir2->mir_name.bv_val )); @@ -38,10 +40,12 @@ mr_index_cmp( static int mr_index_name_cmp( - struct berval *name, - struct mindexrec *mir + const void *v_name, + const void *v_mir ) { + const struct berval *name = v_name; + const struct mindexrec *mir = v_mir; int i = name->bv_len - mir->mir_name.bv_len; if (i) return i; return (strncmp( name->bv_val, mir->mir_name.bv_val, name->bv_len )); @@ -62,8 +66,7 @@ mr_bvfind( struct berval *mrname ) { struct mindexrec *mir = NULL; - if ( (mir = (struct mindexrec *) avl_find( mr_index, mrname, - (AVL_CMP) mr_index_name_cmp )) != NULL ) { + if ( (mir = avl_find( mr_index, mrname, mr_index_name_cmp )) != NULL ) { return( mir->mir_mr ); } return( NULL ); @@ -105,8 +108,7 @@ mr_insert( mir->mir_name.bv_len = strlen( smr->smr_oid ); mir->mir_mr = smr; if ( avl_insert( &mr_index, (caddr_t) mir, - (AVL_CMP) mr_index_cmp, - (AVL_DUP) avl_dup_error ) ) { + mr_index_cmp, avl_dup_error ) ) { *err = smr->smr_oid; ldap_memfree(mir); return SLAP_SCHERR_MR_DUP; @@ -122,8 +124,7 @@ mr_insert( mir->mir_name.bv_len = strlen( *names ); mir->mir_mr = smr; if ( avl_insert( &mr_index, (caddr_t) mir, - (AVL_CMP) mr_index_cmp, - (AVL_DUP) avl_dup_error ) ) { + mr_index_cmp, avl_dup_error ) ) { *err = *names; ldap_memfree(mir); return SLAP_SCHERR_MR_DUP; diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index 8dbe1b29ea..267a762f43 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -119,9 +119,10 @@ static ObjectClass *oc_list = NULL; static int oc_index_cmp( - struct oindexrec *oir1, - struct oindexrec *oir2 ) + const void *v_oir1, + const void *v_oir2 ) { + const struct oindexrec *oir1 = v_oir1, *oir2 = v_oir2; int i = oir1->oir_name.bv_len - oir2->oir_name.bv_len; if (i) return i; @@ -130,9 +131,11 @@ oc_index_cmp( static int oc_index_name_cmp( - struct berval *name, - struct oindexrec *oir ) + const void *v_name, + const void *v_oir ) { + const struct berval *name = v_name; + const struct oindexrec *oir = v_oir; int i = name->bv_len - oir->oir_name.bv_len; if (i) return i; @@ -155,8 +158,7 @@ oc_bvfind( struct berval *ocname ) { struct oindexrec *oir; - oir = (struct oindexrec *) avl_find( oc_index, ocname, - (AVL_CMP) oc_index_name_cmp ); + oir = avl_find( oc_index, ocname, oc_index_name_cmp ); if ( oir != NULL ) { return( oir->oir_oc ); @@ -360,8 +362,7 @@ oc_insert( assert( oir->oir_oc ); if ( avl_insert( &oc_index, (caddr_t) oir, - (AVL_CMP) oc_index_cmp, - (AVL_DUP) avl_dup_error ) ) + oc_index_cmp, avl_dup_error ) ) { *err = soc->soc_oid; ldap_memfree(oir); @@ -384,8 +385,7 @@ oc_insert( assert( oir->oir_oc ); if ( avl_insert( &oc_index, (caddr_t) oir, - (AVL_CMP) oc_index_cmp, - (AVL_DUP) avl_dup_error ) ) + oc_index_cmp, avl_dup_error ) ) { *err = *names; ldap_memfree(oir); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 7a423335b2..dfc0029eb4 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -445,8 +445,8 @@ LDAP_SLAPD_F (int) entry_encode LDAP_P(( Entry *e, struct berval *bv )); LDAP_SLAPD_F (void) entry_free LDAP_P(( Entry *e )); LDAP_SLAPD_F (int) entry_cmp LDAP_P(( Entry *a, Entry *b )); -LDAP_SLAPD_F (int) entry_dn_cmp LDAP_P(( Entry *a, Entry *b )); -LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( Entry *a, Entry *b )); +LDAP_SLAPD_F (int) entry_dn_cmp LDAP_P(( const void *v_a, const void *v_b )); +LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( const void *v_a, const void *v_b )); /* * extended.c diff --git a/servers/slapd/syntax.c b/servers/slapd/syntax.c index f12dd14012..30e5066bf7 100644 --- a/servers/slapd/syntax.c +++ b/servers/slapd/syntax.c @@ -26,20 +26,21 @@ static Syntax *syn_list = NULL; static int syn_index_cmp( - struct sindexrec *sir1, - struct sindexrec *sir2 + const void *v_sir1, + const void *v_sir2 ) { + const struct sindexrec *sir1 = v_sir1, *sir2 = v_sir2; return (strcmp( sir1->sir_name, sir2->sir_name )); } static int syn_index_name_cmp( - const char *name, - struct sindexrec *sir + const void *name, + const void *sir ) { - return (strcmp( name, sir->sir_name )); + return (strcmp( name, ((const struct sindexrec *)sir)->sir_name )); } Syntax * @@ -47,8 +48,7 @@ syn_find( const char *synname ) { struct sindexrec *sir = NULL; - if ( (sir = (struct sindexrec *) avl_find( syn_index, synname, - (AVL_CMP) syn_index_name_cmp )) != NULL ) { + if ( (sir = avl_find( syn_index, synname, syn_index_name_cmp )) != NULL ) { return( sir->sir_syn ); } return( NULL ); @@ -107,8 +107,7 @@ syn_insert( sir->sir_name = ssyn->ssyn_oid; sir->sir_syn = ssyn; if ( avl_insert( &syn_index, (caddr_t) sir, - (AVL_CMP) syn_index_cmp, - (AVL_DUP) avl_dup_error ) ) { + syn_index_cmp, avl_dup_error ) ) { *err = ssyn->ssyn_oid; ldap_memfree(sir); return SLAP_SCHERR_SYN_DUP;