mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
minor optimisations, g_list_prepend then g_list_sort separately
if building a g_list incrementally, don't sort on each insertion.
This commit is contained in:
parent
5c06f7f8c0
commit
6eb2e36c2d
@ -3933,12 +3933,12 @@ xaccAccountFindOpenLots (const Account *acc,
|
||||
continue;
|
||||
|
||||
/* Ok, this is a valid lot. Add it to our list of lots */
|
||||
if (sort_func)
|
||||
retval = g_list_insert_sorted (retval, lot, sort_func);
|
||||
else
|
||||
retval = g_list_prepend (retval, lot);
|
||||
retval = g_list_prepend (retval, lot);
|
||||
}
|
||||
|
||||
if (sort_func)
|
||||
retval = g_list_sort (retval, sort_func);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -1045,13 +1045,15 @@ gncOwnerSetLotLinkMemo (Transaction *ll_txn)
|
||||
|
||||
title = g_strdup_printf ("%s %s", gncInvoiceGetTypeString (invoice), gncInvoiceGetID (invoice));
|
||||
|
||||
titles = g_list_insert_sorted (titles, title, (GCompareFunc)g_strcmp0);
|
||||
titles = g_list_prepend (titles, title);
|
||||
splits = g_list_prepend (splits, split); // splits don't need to be sorted
|
||||
}
|
||||
|
||||
if (!titles)
|
||||
return; // We didn't find document lots
|
||||
|
||||
titles = g_list_sort (titles, (GCompareFunc)g_strcmp0);
|
||||
|
||||
// Create the memo as we'd want it to be
|
||||
new_memo = g_strconcat (memo_prefix, titles->data, NULL);
|
||||
for (titer = titles->next; titer; titer = titer->next)
|
||||
|
Loading…
Reference in New Issue
Block a user