Improve performance of qof_query_invert().

Prepend terms and reverse once at the end instead of "reverse, prepend,
reverse" for each term.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17001 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2008-03-02 22:12:00 +00:00
parent 2820972c30
commit 2cbd6ccdd6

View File

@ -1022,14 +1022,9 @@ QofQuery * qof_query_invert (QofQuery *q)
qt = copy_query_term(cur->data);
qt->invert = !(qt->invert);
new_oterm = g_list_append(NULL, qt);
/* g_list_append() can take forever, so let's do this for speed
* in "large" queries.
*/
retval->terms = g_list_reverse(retval->terms);
retval->terms = g_list_prepend(retval->terms, new_oterm);
retval->terms = g_list_reverse(retval->terms);
}
retval->terms = g_list_reverse(retval->terms);
break;
/* If there are multiple OR-terms, we just recurse by