ITS#6831 don't push stack unless needed

This commit is contained in:
Howard Chu 2011-06-03 22:22:48 -07:00
parent f5b809b2e9
commit 3fb9d604ef

View File

@ -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;