mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 18:30:23 -06:00
Avoid unnecessary g_list_length in equality functions
This commit is contained in:
parent
f0970c8eb4
commit
f40dbb8c28
@ -1458,23 +1458,26 @@ gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2)
|
||||
if (q1 == q2) return TRUE;
|
||||
if (!q1 || !q2) return FALSE;
|
||||
|
||||
if (g_list_length (q1->terms) != g_list_length (q2->terms)) return FALSE;
|
||||
if (q1->max_results != q2->max_results) return FALSE;
|
||||
|
||||
for (or1 = q1->terms, or2 = q2->terms; or1;
|
||||
or1 = or1->next, or2 = or2->next)
|
||||
for (or1 = q1->terms, or2 = q2->terms; or1 || or2;
|
||||
or1 = or1->next, or2 = or2->next)
|
||||
{
|
||||
GList *and1, *and2;
|
||||
|
||||
if (!or1 || !or2)
|
||||
return FALSE;
|
||||
and1 = static_cast<GList*>(or1->data);
|
||||
and2 = static_cast<GList*>(or2->data);
|
||||
|
||||
if (g_list_length (and1) != g_list_length (and2)) return FALSE;
|
||||
|
||||
for ( ; and1; and1 = and1->next, and2 = and2->next)
|
||||
for (; and1 || and2; and1 = and1->next, and2 = and2->next)
|
||||
{
|
||||
if (!and1 || !and2)
|
||||
return FALSE;
|
||||
if (!qof_query_term_equal (static_cast<QofQueryTerm*>(and1->data),
|
||||
static_cast<QofQueryTerm*>(and2->data)))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!qof_query_sort_equal (&(q1->primary_sort), &(q2->primary_sort)))
|
||||
|
@ -732,9 +732,10 @@ guid_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
|
||||
GList *l1 = pd1->guids, *l2 = pd2->guids;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
if (g_list_length (l1) != g_list_length (l2)) return FALSE;
|
||||
for ( ; l1 ; l1 = l1->next, l2 = l2->next)
|
||||
for (; l1 || l2; l1 = l1->next, l2 = l2->next)
|
||||
{
|
||||
if (!l1 || !l2)
|
||||
return FALSE;
|
||||
if (!guid_equal (static_cast<GncGUID*>(l1->data),
|
||||
static_cast<GncGUID*>(l2->data)))
|
||||
return FALSE;
|
||||
@ -1525,9 +1526,10 @@ choice_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
|
||||
GList *l1 = pd1->guids, *l2 = pd2->guids;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
if (g_list_length (l1) != g_list_length (l2)) return FALSE;
|
||||
for ( ; l1 ; l1 = l1->next, l2 = l2->next)
|
||||
for (; l1 || l2; l1 = l1->next, l2 = l2->next)
|
||||
{
|
||||
if (!l1 || !l2)
|
||||
return FALSE;
|
||||
if (!guid_equal (static_cast<GncGUID*>(l1->data),
|
||||
static_cast<GncGUID*>(l2->data)))
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user