Replace custom TAILQ concatenation loop by TAILQ_CONCAT(3).

Comments/OK?


diff --git usr.sbin/ldapd/search.c usr.sbin/ldapd/search.c
index 3033823eb18..887af5fb6a1 100644
--- usr.sbin/ldapd/search.c
+++ usr.sbin/ldapd/search.c
@@ -764,11 +764,8 @@ search_planner(struct namespace *ns, struct ber_element 
*filter)
                /* Select an index to use. */
                TAILQ_FOREACH(arg, &plan->args, next) {
                        if (arg->indexed) {
-                               while ((indx = TAILQ_FIRST(&arg->indices))) {
-                                       TAILQ_REMOVE(&arg->indices, indx, next);
-                                       TAILQ_INSERT_TAIL(&plan->indices, indx,
-                                           next);
-                               }
+                               TAILQ_CONCAT(&plan->indices, &arg->indices,
+                                   next);
                                plan->indexed = arg->indexed;
                                break;
                        }
@@ -796,11 +793,9 @@ search_planner(struct namespace *ns, struct ber_element 
*filter)
                                plan->indexed = 0;
                                break;
                        }
-                       while ((indx = TAILQ_FIRST(&arg->indices))) {
-                               TAILQ_REMOVE(&arg->indices, indx, next);
-                               TAILQ_INSERT_TAIL(&plan->indices, indx,next);
+                       TAILQ_FOREACH(indx, &arg->indices, next)
                                plan->indexed++;
-                       }
+                       TAILQ_CONCAT(&plan->indices, &arg->indices, next);
                }
                break;
        case LDAP_FILT_NOT:

Reply via email to