From 3fb9d604ef577a36a8f836a2ccec1ff0c12ea76a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 3 Jun 2011 22:22:48 -0700 Subject: [PATCH] ITS#6831 don't push stack unless needed --- servers/slapd/overlays/pcache.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 4fc84cdaf5..6875b19fa7 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1352,14 +1352,16 @@ nextpass: eqpass = 1; switch (fs->f_choice) { case LDAP_FILTER_OR: case LDAP_FILTER_AND: + if ( fs->f_next ) { + /* save our stack position */ + fsp = op->o_tmpalloc(sizeof(fstack), op->o_tmpmemctx); + fsp->fs_next = stack; + fsp->fs_fs = fs->f_next; + fsp->fs_fi = fi->f_next; + stack = fsp; + } fs = fs->f_and; fi = fi->f_and; - /* save our stack position */ - fsp = op->o_tmpalloc(sizeof(fstack), op->o_tmpmemctx); - fsp->fs_next = stack; - fsp->fs_fs = fs->f_next; - fsp->fs_fi = fi->f_next; - stack = fsp; res=1; break; case LDAP_FILTER_SUBSTRINGS: @@ -1408,6 +1410,7 @@ nextpass: eqpass = 1; break; } if (!fs && !fi && stack) { + /* pop the stack */ fsp = stack; stack = fsp->fs_next; fs = fsp->fs_fs;