From: Kurt Zeilenga Date: Thu, 11 Feb 1999 18:19:52 +0000 (+0000) Subject: Consistently use %ld for printing IDs. %lu was used in many cases. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~595 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2a20131eaa6c963884881a48f8ec73df621b4d74;p=openldap Consistently use %ld for printing IDs. %lu was used in many cases. I rather have NOID printed as "-1". It it could argued that ID should be signed. --- diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index b37f1c6de5..b23ca2a776 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -41,7 +41,7 @@ static void lru_print(struct cache *cache); static int cache_entry_rdwr_lock(Entry *e, int rw) { - Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%slock: ID: %lu\n", + Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%slock: ID: %ld\n", rw ? "w" : "r", e->e_id, 0); if (rw) @@ -53,7 +53,7 @@ cache_entry_rdwr_lock(Entry *e, int rw) static int cache_entry_rdwr_trylock(Entry *e, int rw) { - Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%strylock: ID: %lu\n", + Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%strylock: ID: %ld\n", rw ? "w" : "r", e->e_id, 0); if (rw) @@ -65,7 +65,7 @@ cache_entry_rdwr_trylock(Entry *e, int rw) static int cache_entry_rdwr_unlock(Entry *e, int rw) { - Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%sunlock: ID: %lu\n", + Debug( LDAP_DEBUG_ARGS, "entry_rdwr_%sunlock: ID: %ld\n", rw ? "w" : "r", e->e_id, 0); if (rw) @@ -143,7 +143,7 @@ cache_return_entry_rw( struct cache *cache, Entry *e, int rw ) if ( LEI(e)->lei_state == CACHE_ENTRY_CREATING ) { Debug( LDAP_DEBUG_TRACE, - "====> cache_return_entry_%s( %lu ): created (%d)\n", + "====> cache_return_entry_%s( %ld ): created (%d)\n", rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt ); LEI(e)->lei_state = CACHE_ENTRY_READY; @@ -151,12 +151,12 @@ cache_return_entry_rw( struct cache *cache, Entry *e, int rw ) } else if ( LEI(e)->lei_state == CACHE_ENTRY_DELETED ) { if( LEI(e)->lei_refcnt > 0 ) { Debug( LDAP_DEBUG_TRACE, - "====> cache_return_entry_%s( %lu ): delete pending (%d)\n", + "====> cache_return_entry_%s( %ld ): delete pending (%d)\n", rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt ); } else { Debug( LDAP_DEBUG_TRACE, - "====> cache_return_entry_%s( %lu ): deleted (%d)\n", + "====> cache_return_entry_%s( %ld ): deleted (%d)\n", rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt ); cache_entry_private_destroy( e ); @@ -165,7 +165,7 @@ cache_return_entry_rw( struct cache *cache, Entry *e, int rw ) } else { Debug( LDAP_DEBUG_TRACE, - "====> cache_return_entry_%s( %lu ): returned (%d)\n", + "====> cache_return_entry_%s( %ld ): returned (%d)\n", rw ? "w" : "r", e->e_id, LEI(e)->lei_refcnt); } @@ -224,7 +224,7 @@ cache_add_entry_rw( if( cache_entry_private_init(e) != 0 ) { Debug( LDAP_DEBUG_ANY, - "====> cache_add_entry( %lu ): \"%s\": private init failed!\n", + "====> cache_add_entry( %ld ): \"%s\": private init failed!\n", e->e_id, e->e_dn, 0 ); return( -1 ); } @@ -233,7 +233,7 @@ cache_add_entry_rw( entry_dn_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_TRACE, - "====> cache_add_entry( %lu ): \"%s\": already in dn cache\n", + "====> cache_add_entry( %ld ): \"%s\": already in dn cache\n", e->e_id, e->e_dn, 0 ); cache_entry_private_destroy(e); @@ -248,7 +248,7 @@ cache_add_entry_rw( entry_id_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_ANY, - "====> cache_add_entry( %lu ): \"%s\": already in id cache\n", + "====> cache_add_entry( %ld ): \"%s\": already in id cache\n", e->e_id, e->e_dn, 0 ); @@ -342,7 +342,7 @@ cache_update_entry( entry_dn_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_TRACE, - "====> cache_update_entry( %lu ): \"%s\": already in dn cache\n", + "====> cache_update_entry( %ld ): \"%s\": already in dn cache\n", e->e_id, e->e_dn, 0 ); /* free cache mutex */ @@ -355,7 +355,7 @@ cache_update_entry( entry_id_cmp, avl_dup_error ) != 0 ) { Debug( LDAP_DEBUG_ANY, - "====> cache_update_entry( %lu ): \"%s\": already in id cache\n", + "====> cache_update_entry( %ld ): \"%s\": already in id cache\n", e->e_id, e->e_dn, 0 ); /* delete from dn tree inserted above */ @@ -460,7 +460,7 @@ cache_find_entry_dn2id( assert(LEI(ep)->lei_state != CACHE_ENTRY_UNDEFINED); #endif Debug(LDAP_DEBUG_TRACE, - "====> cache_find_entry_dn2id(\"%s\"): %lu (not ready) %d\n", + "====> cache_find_entry_dn2id(\"%s\"): %ld (not ready) %d\n", dn, ep->e_id, LEI(ep)->lei_state); /* free cache mutex */ @@ -469,7 +469,7 @@ cache_find_entry_dn2id( } Debug(LDAP_DEBUG_TRACE, - "====> cache_find_entry_dn2id(\"%s\"): %lu\n", + "====> cache_find_entry_dn2id(\"%s\"): %ld\n", dn, ep->e_id, 0); /* lru */ @@ -527,7 +527,7 @@ try_again: assert(LEI(ep)->lei_state != CACHE_ENTRY_UNDEFINED); #endif Debug(LDAP_DEBUG_TRACE, - "====> cache_find_entry_id( %lu ): %lu (not ready) %d\n", + "====> cache_find_entry_id( %ld ): %ld (not ready) %d\n", id, ep->e_id, LEI(ep)->lei_state); /* free cache mutex */ @@ -536,7 +536,7 @@ try_again: } Debug(LDAP_DEBUG_TRACE, - "====> cache_find_entry_id( %lu, %s ) \"%s\" (found)\n", + "====> cache_find_entry_id( %ld, %s ) \"%s\" (found)\n", id, rw ? "w" : "r", ep->e_dn); /* acquire reader lock */ @@ -596,7 +596,7 @@ cache_delete_entry( assert( e->e_private ); #endif - Debug( LDAP_DEBUG_TRACE, "====> cache_delete_entry( %lu )\n", + Debug( LDAP_DEBUG_TRACE, "====> cache_delete_entry( %ld )\n", e->e_id, 0, 0 ); rc = cache_delete_entry_internal( cache, e ); @@ -653,12 +653,12 @@ lru_print( struct cache *cache ) fprintf( stderr, "LRU queue (head to tail):\n" ); for ( e = cache->c_lruhead; e != NULL; e = LEI(e)->lei_lrunext ) { - fprintf( stderr, "\tdn \"%20s\" id %lu refcnt %d\n", + fprintf( stderr, "\tdn \"%20s\" id %ld refcnt %d\n", e->e_dn, e->e_id, LEI(e)->lei_refcnt ); } fprintf( stderr, "LRU queue (tail to head):\n" ); for ( e = cache->c_lrutail; e != NULL; e = LEI(e)->lei_lruprev ) { - fprintf( stderr, "\tdn \"%20s\" id %lu refcnt %d\n", + fprintf( stderr, "\tdn \"%20s\" id %ld refcnt %d\n", e->e_dn, e->e_id, LEI(e)->lei_refcnt ); } } diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 38901c0249..31fd296185 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -76,7 +76,7 @@ dn2id( /* first check the cache */ if ( (id = cache_find_entry_dn2id( be, &li->li_cache, dn )) != NOID ) { free( dn ); - Debug( LDAP_DEBUG_TRACE, "<= dn2id %lu (in cache)\n", id, + Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld (in cache)\n", id, 0, 0 ); return( id ); } @@ -106,7 +106,7 @@ dn2id( ldbm_datum_free( db->dbc_db, data ); - Debug( LDAP_DEBUG_TRACE, "<= dn2id %lu\n", id, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "<= dn2id %ld\n", id, 0, 0 ); return( id ); } @@ -179,7 +179,7 @@ dn2entry_rw( if ( id != NOID ) { Debug(LDAP_DEBUG_ANY, - "dn2entry_%s: no entry for valid id (%lu), dn \"%s\"\n", + "dn2entry_%s: no entry for valid id (%ld), dn \"%s\"\n", rw ? "w" : "r", id, dn); /* must have been deleted from underneath us */ /* treat as if NOID was found */ diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c index 5ad17dc0e1..2c32d50d9f 100644 --- a/servers/slapd/back-ldbm/filterindex.c +++ b/servers/slapd/back-ldbm/filterindex.c @@ -86,7 +86,7 @@ filter_candidates( break; } - Debug( LDAP_DEBUG_TRACE, "<= filter_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= filter_candidates %ld\n", result ? ID_BLOCK_NIDS(result) : 0, 0, 0 ); return( result ); } @@ -117,7 +117,7 @@ ava_candidates( break; } - Debug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= ava_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -134,7 +134,7 @@ presence_candidates( idl = index_read( be, type, 0, "*" ); - Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -171,7 +171,7 @@ approx_candidates( } } - Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -212,7 +212,7 @@ list_candidates( } } - Debug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= list_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -279,7 +279,7 @@ substring_candidates( } } - Debug( LDAP_DEBUG_TRACE, "<= substring_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= substring_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -347,7 +347,7 @@ substring_comp_candidates( } } - Debug( LDAP_DEBUG_TRACE, "<= substring_comp_candidates %lu\n", + Debug( LDAP_DEBUG_TRACE, "<= substring_comp_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } diff --git a/servers/slapd/back-ldbm/id2children.c b/servers/slapd/back-ldbm/id2children.c index 69a5d7c589..904a37f970 100644 --- a/servers/slapd/back-ldbm/id2children.c +++ b/servers/slapd/back-ldbm/id2children.c @@ -25,7 +25,7 @@ id2children_add( ldbm_datum_init( key ); - Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %lu, %lu )\n", + Debug( LDAP_DEBUG_TRACE, "=> id2children_add( %ld, %ld )\n", p ? p->e_id : 0, e->e_id, 0 ); if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX, @@ -67,7 +67,7 @@ id2children_remove( ID_BLOCK *idl; char buf[20]; - Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %lu, %lu )\n", p ? p->e_id + Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %ld, %ld )\n", p ? p->e_id : 0, e->e_id, 0 ); if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX, @@ -110,7 +110,7 @@ has_children( ldbm_datum_init( key ); - Debug( LDAP_DEBUG_TRACE, "=> has_children( %lu )\n", p->e_id , 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 ); if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX, LDBM_WRCREAT )) == NULL ) { @@ -133,7 +133,7 @@ has_children( rc = 1; } - Debug( LDAP_DEBUG_TRACE, "<= has_children( %lu ): %s\n", + Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n", p->e_id, rc ? "yes" : "no", 0 ); return( rc ); } diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index 1e38d31a22..58de12b7c7 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -25,7 +25,7 @@ id2entry_add( Backend *be, Entry *e ) ldbm_datum_init( key ); ldbm_datum_init( data ); - Debug( LDAP_DEBUG_TRACE, "=> id2entry_add( %lu, \"%s\" )\n", e->e_id, + Debug( LDAP_DEBUG_TRACE, "=> id2entry_add( %ld, \"%s\" )\n", e->e_id, e->e_dn, 0 ); if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT )) @@ -64,7 +64,7 @@ id2entry_delete( Backend *be, Entry *e ) Datum key; int rc; - Debug(LDAP_DEBUG_TRACE, "=> id2entry_delete( %lu, \"%s\" )\n", e->e_id, + Debug(LDAP_DEBUG_TRACE, "=> id2entry_delete( %ld, \"%s\" )\n", e->e_id, e->e_dn, 0 ); #ifdef notdef @@ -84,7 +84,7 @@ id2entry_delete( Backend *be, Entry *e ) } if ( cache_delete_entry( &li->li_cache, e ) != 0 ) { - Debug(LDAP_DEBUG_ANY, "could not delete %lu (%s) from cache\n", + Debug(LDAP_DEBUG_ANY, "could not delete %ld (%s) from cache\n", e->e_id, e->e_dn, 0 ); } diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index fbc1b5a004..6542fc9f85 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -181,7 +181,7 @@ idl_fetch( } free( (char *) tmp ); - Debug( LDAP_DEBUG_TRACE, "<= idl_fetch %lu ids (%lu max)\n", + Debug( LDAP_DEBUG_TRACE, "<= idl_fetch %ld ids (%ld max)\n", ID_BLOCK_NIDS(idl), ID_BLOCK_NMAX(idl), 0 ); return( idl ); } @@ -500,7 +500,7 @@ idl_insert_key( case 0: /* id inserted */ if ( rc == 2 ) { Debug( LDAP_DEBUG_ANY, - "id %lu already in next block\n", + "id %ld already in next block\n", id, 0, 0 ); } free( kstr ); diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 3a785fd215..0d595119c6 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -111,7 +111,7 @@ index_read( if ( ! (indextype & indexmask) ) { idl = idl_allids( be ); Debug( LDAP_DEBUG_TRACE, - "<= index_read %lu candidates (allids - not indexed)\n", + "<= index_read %ld candidates (allids - not indexed)\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -151,7 +151,7 @@ index_read( ldbm_cache_close( be, db ); - Debug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates\n", + Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } diff --git a/servers/slapd/back-ldbm/nextid.c b/servers/slapd/back-ldbm/nextid.c index 25841ca86d..5d31754a45 100644 --- a/servers/slapd/back-ldbm/nextid.c +++ b/servers/slapd/back-ldbm/nextid.c @@ -42,7 +42,7 @@ next_id_read( Backend *be ) if(id < 1) { Debug( LDAP_DEBUG_ANY, - "next_id_read %lu: atol(%s) return non-positive integer\n", + "next_id_read %ld: atol(%s) return non-positive integer\n", id, buf, 0 ); return NOID; } @@ -60,7 +60,7 @@ next_id_write( Backend *be, ID id ) int rc; if ( (fp = fopen( file, "w" )) == NULL ) { - Debug( LDAP_DEBUG_ANY, "next_id_write(%lu): could not open \"%s\"\n", + Debug( LDAP_DEBUG_ANY, "next_id_write(%ld): could not open \"%s\"\n", id, file, 0 ); return -1; } @@ -68,13 +68,13 @@ next_id_write( Backend *be, ID id ) rc = 0; if ( fprintf( fp, "%ld\n", id ) == EOF ) { - Debug( LDAP_DEBUG_ANY, "next_id_write(%lu): cannot fprintf\n", + Debug( LDAP_DEBUG_ANY, "next_id_write(%ld): cannot fprintf\n", id, 0, 0 ); rc = -1; } if( fclose( fp ) != 0 ) { - Debug( LDAP_DEBUG_ANY, "next_id_write %lu: cannot fclose\n", + Debug( LDAP_DEBUG_ANY, "next_id_write %ld: cannot fclose\n", id, 0, 0 ); rc = -1; } diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index bb5383f49b..a754e21e2a 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -171,7 +171,7 @@ ldbm_back_search( /* get the entry with reader lock */ if ( (e = id2entry_r( be, id )) == NULL ) { - Debug( LDAP_DEBUG_ARGS, "candidate %lu not found\n", + Debug( LDAP_DEBUG_ARGS, "candidate %ld not found\n", id, 0, 0 ); continue; } diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 7099931084..7e2a0b389d 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -98,7 +98,7 @@ str2entry( char *s ) if ( strcasecmp( type, "dn" ) == 0 ) { if ( e->e_dn != NULL ) { Debug( LDAP_DEBUG_ANY, - "str2entry: entry %lu has multiple dns \"%s\" and \"%s\" (second ignored)\n", + "str2entry: entry %ld has multiple dns \"%s\" and \"%s\" (second ignored)\n", e->e_id, e->e_dn, value ); continue; } @@ -106,7 +106,7 @@ str2entry( char *s ) if ( e->e_ndn != NULL ) { Debug( LDAP_DEBUG_ANY, - "str2entry: entry %lu already has a normalized dn \"%s\" for \"%s\" (first ignored)\n", + "str2entry: entry %ld already has a normalized dn \"%s\" for \"%s\" (first ignored)\n", e->e_id, e->e_ndn, value ); free( e->e_ndn ); } @@ -128,7 +128,7 @@ str2entry( char *s ) /* check to make sure there was a dn: line */ if ( e->e_dn == NULL ) { - Debug( LDAP_DEBUG_ANY, "str2entry: entry %lu has no dn\n", + Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has no dn\n", e->e_id, 0, 0 ); entry_free( e ); return( NULL ); @@ -136,13 +136,13 @@ str2entry( char *s ) if ( e->e_ndn == NULL ) { Debug( LDAP_DEBUG_ANY, - "str2entry: entry %lu (\"%s\") has no normalized dn\n", + "str2entry: entry %ld (\"%s\") has no normalized dn\n", e->e_id, e->e_dn, 0 ); entry_free( e ); return( NULL ); } - Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %lu (0x%lx)\n", + Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %ld (0x%lx)\n", e->e_dn, e->e_id, (unsigned long)e ); return( e );