From b45c15fdc9728fe87a03fe2ba409e733f1114f8e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 14 Aug 2007 18:54:28 +0000 Subject: [PATCH] TS#4627 fix tool_entry_first() --- servers/slapd/back-ldif/ldif.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/servers/slapd/back-ldif/ldif.c b/servers/slapd/back-ldif/ldif.c index 72fd1be53a..c7614f5e23 100644 --- a/servers/slapd/back-ldif/ldif.c +++ b/servers/slapd/back-ldif/ldif.c @@ -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) {