-/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
-
-
-static void da_split_free(Split *item)
-{
- if(item != NULL)
- {
- if(item->memo != NULL)
- g_free(item->memo);
-
- g_free(item);
- }
-}
-
-
-static Split *da_split_malloc(void)
-{
- return g_malloc0(sizeof(Split));
-}
-
-
-Split *da_split_new(guint32 kcat, gdouble amount, gchar *memo)
-{
-Split *split = da_split_malloc();
-
- split->kcat = kcat;
- split->amount = amount;
- split->memo = g_strdup(memo);
- return split;
-}
-
-
-
-static Split *da_split_clone(Split *src_split)
-{
-Split *new_split = g_memdup(src_split, sizeof(Split));
-
- DB( g_print("da_split_clone\n") );
-
- if(new_split)
- {
- //duplicate the string
- new_split->memo = g_strdup(src_split->memo);
- DB( g_print(" clone %p -> %p\n", src_split, new_split) );
-
- }
- return new_split;
-}
-
-/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
-
-
-guint da_transaction_splits_count(Transaction *txn)
-{
-guint i, count = 0;
-
- for(i=0;i<TXN_MAX_SPLIT;i++)
- {
- if(txn->splits[i] == NULL)
- break;
- count++;
- }
- return count;
-}
-
-
-void da_transaction_splits_free(Transaction *txn)
-{
-guint count, i=0;
-
- count = da_transaction_splits_count(txn);
- if(count == 0)
- return;
-
- DB( g_print("da_transaction_splits_free\n") );
-
- for(;i<=count;i++)
- {
- DB( g_print("- freeing %d :: %p\n", i, txn->splits[i]) );
-
- da_split_free(txn->splits[i]);
- txn->splits[i] = NULL;
- }
- //remove the flag
- txn->flags &= ~(OF_SPLIT);
-
-}
-
-
-void da_transaction_splits_append(Transaction *txn, Split *split)
-{
-guint count = da_transaction_splits_count(txn);
-
- DB( g_print("da_transaction_splits_append\n") );
-
- DB( g_print("- split[%d] at %p for ope %p\n", count, split, txn) );
-
- txn->flags |= OF_SPLIT;
- txn->splits[count] = split;
- txn->splits[count + 1] = NULL;
-
- DB( g_print("- %d splits\n", da_transaction_splits_count(txn)) );
-}
-
-
-void da_transaction_splits_clone(Transaction *stxn, Transaction *dtxn)
-{
-gint i, count;
-
- DB( g_print("da_transaction_splits_clone\n") );
-
- count = da_transaction_splits_count(stxn);
- for(i=0;i<count;i++)
- {
- dtxn->splits[i] = da_split_clone(stxn->splits[i]);
- }
-
- if(count > 0)
- dtxn->flags |= OF_SPLIT;
-
- DB( g_print(" clone %p -> %p, %d splits\n", stxn, dtxn, count) );
-}
-
-
-