]> git.sur5r.net Git - openldap/commitdiff
TS#4627 fix tool_entry_first()
authorHoward Chu <hyc@openldap.org>
Tue, 14 Aug 2007 18:54:28 +0000 (18:54 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 14 Aug 2007 18:54:28 +0000 (18:54 +0000)
servers/slapd/back-ldif/ldif.c

index 72fd1be53a0781f67f17dccc54303d3071f33cd8..c7614f5e235721a27bef34f0ce921690210d9d36 100644 (file)
@@ -1162,13 +1162,21 @@ static int ldif_tool_entry_close(BackendDB * be) {
        return 0;
 }
 
+static ID ldif_tool_entry_next(BackendDB *be)
+{
+       struct ldif_info *li = (struct ldif_info *) be->be_private;
+       li->li_tool_current += 1;
+       if(li->li_tool_current > li->li_tool_cookie.eind)
+               return NOID;
+       else
+               return li->li_tool_current;
+}
+
 static ID
 ldif_tool_entry_first(BackendDB *be)
 {
        struct ldif_info *li = (struct ldif_info *) be->be_private;
-       ID id = 1; /* first entry in the array of entries shifted by one */
 
-       li->li_tool_current = 1;
        if(li->li_tool_cookie.entries == NULL) {
                Operation op = {0};
 
@@ -1180,17 +1188,7 @@ ldif_tool_entry_first(BackendDB *be)
                (void)enum_tree( &li->li_tool_cookie );
                li->li_tool_cookie.op = NULL;
        }
-       return id;
-}
-
-static ID ldif_tool_entry_next(BackendDB *be)
-{
-       struct ldif_info *li = (struct ldif_info *) be->be_private;
-       li->li_tool_current += 1;
-       if(li->li_tool_current > li->li_tool_cookie.eind)
-               return NOID;
-       else
-               return li->li_tool_current;
+       return ldif_tool_entry_next( be );
 }
 
 static Entry * ldif_tool_entry_get(BackendDB * be, ID id) {