}
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback,
- *sc_next = op->o_callback;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
rc = SLAP_CB_CONTINUE;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_response ) {
rc = op->o_callback->sc_response( op, rs );
- if ( first && op->o_callback == NULL ) {
- sc = NULL;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
- if ( rc != SLAP_CB_CONTINUE ) break;
+ if ( rc != SLAP_CB_CONTINUE || !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
clean2:;
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback, *sc_next;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_cleanup ) {
(void)op->o_callback->sc_cleanup( op, rs );
- if ( first && op->o_callback != sc ) {
- sc = op->o_callback;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
+ if ( !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
}
}
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback,
- *sc_next = op->o_callback;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
rc = SLAP_CB_CONTINUE;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next )
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_response ) {
rc = op->o_callback->sc_response( op, rs );
- if ( first && op->o_callback == NULL ) {
- sc = NULL;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
- if ( rc != SLAP_CB_CONTINUE ) break;
+ if ( rc != SLAP_CB_CONTINUE || !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
error_return:;
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback, *sc_next;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_cleanup ) {
(void)op->o_callback->sc_cleanup( op, rs );
- if ( first && op->o_callback != sc ) {
- sc = op->o_callback;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
+ if ( !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
}
rs->sr_type = REP_SEARCHREF;
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback,
- *sc_next = op->o_callback;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
rc = SLAP_CB_CONTINUE;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_response ) {
rc = op->o_callback->sc_response( op, rs );
- if ( first && op->o_callback == NULL ) {
- sc = NULL;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
- if ( rc != SLAP_CB_CONTINUE ) break;
+ if ( rc != SLAP_CB_CONTINUE || !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
rel:
if ( op->o_callback ) {
- int first = 1;
- slap_callback *sc = op->o_callback, *sc_next;
+ slap_callback *sc = op->o_callback, **sc_prev = &op->o_callback,
+ *sc_next;
for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
sc_next = op->o_callback->sc_next;
if ( op->o_callback->sc_cleanup ) {
(void)op->o_callback->sc_cleanup( op, rs );
- if ( first && op->o_callback != sc ) {
- sc = op->o_callback;
+ if ( op->o_callback != *sc_prev ) {
+ *sc_prev = op->o_callback;
}
+ if ( rc != SLAP_CB_CONTINUE || !op->o_callback ) break;
}
- first = 0;
+ sc_prev = &op->o_callback->sc_next;
}
op->o_callback = sc;
}