From 98966abeefe9a0addb9e9ed54af02816806f83bd Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 30 Dec 2010 23:43:12 +0000 Subject: [PATCH] noop commit for ITS#6758: Remove no-effect code. Unused variable resets, unused SlapReply parameters to some functions. --- servers/slapd/backend.c | 4 +--- servers/slapd/overlays/constraint.c | 14 ++++---------- servers/slapd/overlays/memberof.c | 29 +++++++++++++---------------- servers/slapd/overlays/pcache.c | 24 ++++++++---------------- servers/slapd/overlays/rwm.c | 20 ++++++++++---------- servers/slapd/overlays/syncprov.c | 7 +++---- 6 files changed, 39 insertions(+), 59 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index a3695ec1be..c19501d758 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -1689,8 +1689,7 @@ fe_acl_attribute( * to do no harm to entries */ rs.sr_entry = e; rc = backend_operational( op, &rs ); - rs.sr_entry = NULL; - + if ( rc == LDAP_SUCCESS ) { if ( rs.sr_operational_attrs ) { freeattr = 1; @@ -1856,7 +1855,6 @@ backend_access( * to do no harm to entries */ rs.sr_entry = e; rc = backend_operational( op, &rs ); - rs.sr_entry = NULL; if ( rc == LDAP_SUCCESS ) { if ( rs.sr_operational_attrs ) { diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c index dc6039de43..9027dbb6b9 100644 --- a/servers/slapd/overlays/constraint.c +++ b/servers/slapd/overlays/constraint.c @@ -541,7 +541,7 @@ constraint_uri_cb( Operation *op, SlapReply *rs ) } static int -constraint_violation( constraint *c, struct berval *bv, Operation *op, SlapReply *rs) +constraint_violation( constraint *c, struct berval *bv, Operation *op ) { if ((!c) || (!bv)) return LDAP_SUCCESS; @@ -558,17 +558,12 @@ constraint_violation( constraint *c, struct berval *bv, Operation *op, SlapReply slap_callback cb; SlapReply nrs = { REP_RESULT }; int i; - int found; + int found = 0; int rc; size_t len; struct berval filterstr; char *ptr; - found = 0; - - nrs.sr_entry = NULL; - nrs.sr_nentries = 0; - cb.sc_next = NULL; cb.sc_response = constraint_uri_cb; cb.sc_cleanup = NULL; @@ -663,7 +658,6 @@ constraint_violation( constraint *c, struct berval *bv, Operation *op, SlapReply if (!found) return LDAP_CONSTRAINT_VIOLATION; /* constraint violation */ - } return LDAP_SUCCESS; @@ -796,7 +790,7 @@ constraint_add( Operation *op, SlapReply *rs ) } for ( i = 0; b[i].bv_val; i++ ) { - rc = constraint_violation( cp, &b[i], op, rs ); + rc = constraint_violation( cp, &b[i], op ); if ( rc ) { goto add_violation; } @@ -949,7 +943,7 @@ constraint_update( Operation *op, SlapReply *rs ) continue; for ( i = 0; b[i].bv_val; i++ ) { - rc = constraint_violation( cp, &b[i], op, rs ); + rc = constraint_violation( cp, &b[i], op ); if ( rc ) { goto mod_violation; } diff --git a/servers/slapd/overlays/memberof.c b/servers/slapd/overlays/memberof.c index 90d6795bea..f17d75bb6c 100644 --- a/servers/slapd/overlays/memberof.c +++ b/servers/slapd/overlays/memberof.c @@ -323,10 +323,9 @@ memberof_isGroupOrMember( Operation *op, memberof_cbinfo_t *mci ) /* * response callback that adds memberof values when a group is modified. */ -static int +static void memberof_value_modify( Operation *op, - SlapReply *rs, struct berval *ndn, AttributeDescription *ad, struct berval *old_dn, @@ -456,8 +455,6 @@ memberof_value_modify( * add will fail; better split in two operations, although * not optimal in terms of performance. At least it would * move towards self-repairing capabilities. */ - - return rs2.sr_err; } static int @@ -1194,7 +1191,7 @@ memberof_res_add( Operation *op, SlapReply *rs ) /* the modification is attempted * with the original identity */ - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &ma->a_nvals[ i ], mo->mo_ad_member, NULL, NULL, &op->o_req_dn, &op->o_req_ndn ); } @@ -1209,7 +1206,7 @@ memberof_res_add( Operation *op, SlapReply *rs ) a = attrs_find( a->a_next, mo->mo_ad_member ) ) { for ( i = 0; !BER_BVISNULL( &a->a_nvals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &a->a_nvals[ i ], mo->mo_ad_memberof, NULL, NULL, @@ -1242,7 +1239,7 @@ memberof_res_delete( Operation *op, SlapReply *rs ) vals = mci->member; if ( vals != NULL ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_memberof, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1253,7 +1250,7 @@ memberof_res_delete( Operation *op, SlapReply *rs ) vals = mci->memberof; if ( vals != NULL ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_member, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1299,7 +1296,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) case LDAP_MOD_DELETE: if ( vals != NULL ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_member, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1316,7 +1313,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) op->o_bd->bd_info = (BackendInfo *)on; if ( rc == LDAP_SUCCESS ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_member, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1333,7 +1330,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) assert( vals != NULL ); for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_member, NULL, NULL, &op->o_req_dn, &op->o_req_ndn ); @@ -1357,7 +1354,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) vals = ml->sml_nvalues; if ( vals != NULL ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_memberof, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1372,7 +1369,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) /* delete all ... */ if ( vals != NULL ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_memberof, &op->o_req_dn, &op->o_req_ndn, NULL, NULL ); @@ -1388,7 +1385,7 @@ memberof_res_modify( Operation *op, SlapReply *rs ) assert( ml->sml_nvalues != NULL ); vals = ml->sml_nvalues; for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_memberof, NULL, NULL, &op->o_req_dn, &op->o_req_ndn ); @@ -1469,7 +1466,7 @@ memberof_res_modrdn( Operation *op, SlapReply *rs ) if ( rc == LDAP_SUCCESS ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_memberof, &op->o_req_dn, &op->o_req_ndn, &newDN, &newNDN ); @@ -1486,7 +1483,7 @@ memberof_res_modrdn( Operation *op, SlapReply *rs ) if ( rc == LDAP_SUCCESS ) { for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { - (void)memberof_value_modify( op, rs, + memberof_value_modify( op, &vals[ i ], mo->mo_ad_member, &op->o_req_dn, &op->o_req_ndn, &newDN, &newNDN ); diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index e15b768feb..7efbff133e 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -346,7 +346,6 @@ add_query( static int remove_query_data( Operation *op, - SlapReply *rs, struct berval *query_uuid ); /* @@ -752,11 +751,10 @@ url2query( /* ignore expired queries */ if ( expiry_time <= slap_get_time()) { Operation op2 = *op; - SlapReply rs2 = { 0 }; memset( &op2.oq_search, 0, sizeof( op2.oq_search ) ); - (void)remove_query_data( &op2, &rs2, &uuid ); + (void)remove_query_data( &op2, &uuid ); rc = 0; @@ -1748,7 +1746,6 @@ remove_func ( static int remove_query_data( Operation *op, - SlapReply *rs, struct berval *query_uuid ) { struct query_info *qi, *qnext; @@ -1759,8 +1756,6 @@ remove_query_data( slap_callback cb = { NULL, remove_func, NULL, NULL }; int deleted = 0; - sreply.sr_entry = NULL; - sreply.sr_nentries = 0; op->ors_filterstr.bv_len = snprintf(filter_str, sizeof(filter_str), "(%s=%s)", ad_queryId->ad_cname.bv_val, query_uuid->bv_val); filter.f_ava = &ava; @@ -1971,7 +1966,6 @@ struct search_info { static void remove_query_and_data( Operation *op, - SlapReply *rs, cache_manager *cm, struct berval *uuid ) { @@ -1984,7 +1978,7 @@ remove_query_and_data( Debug( pcache_debug, "Removing query UUID %s\n", uuid->bv_val, 0, 0 ); - return_val = remove_query_data( op, rs, uuid ); + return_val = remove_query_data( op, uuid ); Debug( pcache_debug, "QUERY REMOVED, SIZE=%d\n", return_val, 0, 0); @@ -2122,7 +2116,7 @@ pcache_remove_entries_from_cache( for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { struct berval val = vals[ i ]; - remove_query_and_data( op, &rs, cm, &val ); + remove_query_and_data( op, cm, &val ); if ( !BER_BVISNULL( &val ) && val.bv_val != vals[ i ].bv_val ) { ch_free( val.bv_val ); @@ -2147,12 +2141,11 @@ pcache_remove_query_from_cache( struct berval *queryid ) { Operation op2 = *op; - SlapReply rs2 = { 0 }; op2.o_bd = &cm->db; /* remove the selected query */ - remove_query_and_data( &op2, &rs2, cm, queryid ); + remove_query_and_data( &op2, cm, queryid ); return LDAP_SUCCESS; } @@ -2243,7 +2236,7 @@ pcache_remove_entry_queries_from_cache( for ( i = 0; !BER_BVISNULL( &vals[ i ] ); i++ ) { struct berval val = vals[ i ]; - remove_query_and_data( op, &rs, cm, &val ); + remove_query_and_data( op, cm, &val ); if ( !BER_BVISNULL( &val ) && val.bv_val != vals[ i ].bv_val ) { ch_free( val.bv_val ); @@ -2259,7 +2252,6 @@ pcache_remove_entry_queries_from_cache( static int cache_entries( Operation *op, - SlapReply *rs, struct berval *query_uuid ) { struct search_info *si = op->o_callback->sc_private; @@ -2291,7 +2283,7 @@ cache_entries( e->e_private = NULL; while ( cm->cur_entries > (cm->max_entries) ) { BER_BVZERO( &crp_uuid ); - remove_query_and_data( op_tmp, rs, cm, &crp_uuid ); + remove_query_and_data( op_tmp, cm, &crp_uuid ); } return_val = merge_entry(op_tmp, e, 0, query_uuid); @@ -2399,7 +2391,7 @@ over:; if ( qc != NULL ) { switch ( si->caching_reason ) { case PC_POSITIVE: - cache_entries( op, rs, &qc->q_uuid ); + cache_entries( op, &qc->q_uuid ); if ( si->pbi ) si->pbi->bi_cq = qc; break; @@ -3521,7 +3513,7 @@ consistency_check( if ( BER_BVISNULL( &query->q_uuid )) return_val = 0; else - return_val = remove_query_data(op, &rs, &query->q_uuid); + return_val = remove_query_data(op, &query->q_uuid); Debug( pcache_debug, "STALE QUERY REMOVED, SIZE=%d\n", return_val, 0, 0 ); ldap_pvt_thread_mutex_lock(&cm->cache_mutex); diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 54dc366c3a..7bdcfab24c 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -172,7 +172,7 @@ rwm_op_cleanup( Operation *op, SlapReply *rs ) } static rwm_op_cb * -rwm_callback_get( Operation *op, SlapReply *rs ) +rwm_callback_get( Operation *op ) { rwm_op_cb *roc; @@ -270,7 +270,7 @@ rwm_op_add( Operation *op, SlapReply *rs ) char *olddn = op->o_req_dn.bv_val; int isupdate; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "addDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -413,7 +413,7 @@ rwm_op_bind( Operation *op, SlapReply *rs ) slap_overinst *on = (slap_overinst *) op->o_bd->bd_info; int rc; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "bindDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -449,7 +449,7 @@ rwm_op_compare( Operation *op, SlapReply *rs ) int rc; struct berval mapped_vals[2] = { BER_BVNULL, BER_BVNULL }; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "compareDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -534,7 +534,7 @@ rwm_op_delete( Operation *op, SlapReply *rs ) slap_overinst *on = (slap_overinst *) op->o_bd->bd_info; int rc; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "deleteDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -559,7 +559,7 @@ rwm_op_modify( Operation *op, SlapReply *rs ) Modifications **mlp; int rc; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "modifyDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -722,7 +722,7 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) int rc; dncookie dc; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); if ( op->orr_newSup ) { struct berval nnewSup = BER_BVNULL; @@ -941,7 +941,7 @@ rwm_op_search( Operation *op, SlapReply *rs ) char *text = NULL; - rwm_op_cb *roc = rwm_callback_get( op, rs ); + rwm_op_cb *roc = rwm_callback_get( op ); rc = rewrite_session_var_set( rwmap->rwm_rw, op->o_conn, "searchFilter", op->ors_filterstr.bv_val ); @@ -1060,7 +1060,7 @@ rwm_exop_passwd( Operation *op, SlapReply *rs ) ber_dupbv_x( &op->o_req_ndn, &op->o_ndn, op->o_tmpmemctx ); } - roc = rwm_callback_get( op, rs ); + roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "extendedDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { @@ -1132,7 +1132,7 @@ rwm_extended( Operation *op, SlapReply *rs ) } } - roc = rwm_callback_get( op, rs ); + roc = rwm_callback_get( op ); rc = rwm_op_dn_massage( op, rs, "extendedDN", &roc->ros ); if ( rc != LDAP_SUCCESS ) { diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 911631ac58..7fa8e73ea7 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1418,7 +1418,7 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs ) } static void -syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) +syncprov_checkpoint( Operation *op, slap_overinst *on ) { syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private; Modifications mod; @@ -1893,7 +1893,7 @@ syncprov_op_response( Operation *op, SlapReply *rs ) if ( do_check ) { ldap_pvt_thread_rdwr_rlock( &si->si_csn_rwlock ); - syncprov_checkpoint( op, rs, on ); + syncprov_checkpoint( op, on ); ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock ); } @@ -3085,7 +3085,6 @@ syncprov_db_close( Connection conn = {0}; OperationBuffer opbuf; Operation *op; - SlapReply rs = {REP_RESULT}; void *thrctx; thrctx = ldap_pvt_thread_pool_context(); @@ -3094,7 +3093,7 @@ syncprov_db_close( op->o_bd = be; op->o_dn = be->be_rootdn; op->o_ndn = be->be_rootndn; - syncprov_checkpoint( op, &rs, on ); + syncprov_checkpoint( op, on ); } #ifdef SLAP_CONFIG_DELETE -- 2.39.5