r19652 - gnucash/trunk/src - Replace some renamed functions by their real new names, removing the annoying #defines.

Christian Stimming cstim at code.gnucash.org
Wed Oct 13 12:16:04 EDT 2010


Author: cstim
Date: 2010-10-13 12:16:04 -0400 (Wed, 13 Oct 2010)
New Revision: 19652
Trac: http://svn.gnucash.org/trac/changeset/19652

Modified:
   gnucash/trunk/src/app-utils/test/test-print-queries.c
   gnucash/trunk/src/app-utils/test/test-scm-query-string.c
   gnucash/trunk/src/backend/xml/io-gncxml-v1.c
   gnucash/trunk/src/engine/Query.c
   gnucash/trunk/src/engine/Query.h
   gnucash/trunk/src/engine/engine-helpers.c
   gnucash/trunk/src/engine/test-core/test-engine-stuff.c
   gnucash/trunk/src/engine/test/test-query.c
   gnucash/trunk/src/engine/test/test-scm-query.c
   gnucash/trunk/src/experimental/cgi-bin/gnc-server.c
   gnucash/trunk/src/experimental/cgi-bin/hello2.c
   gnucash/trunk/src/experimental/cgi-bin/hello3.c
   gnucash/trunk/src/gnome-utils/gnc-query-list.c
   gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
   gnucash/trunk/src/gnome/reconcile-list.c
   gnucash/trunk/src/import-export/import-backend.c
   gnucash/trunk/src/register/ledger-core/gnc-ledger-display.c
Log:
Replace some renamed functions by their real new names, removing the annoying #defines.

Modified: gnucash/trunk/src/app-utils/test/test-print-queries.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-print-queries.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/app-utils/test/test-print-queries.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -45,7 +45,7 @@
     {
         q = get_random_query ();
         test_query (q, val2str);
-        xaccFreeQuery (q);
+        qof_query_destroy (q);
     }
     success ("");
 }

Modified: gnucash/trunk/src/app-utils/test/test-scm-query-string.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-scm-query-string.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/app-utils/test/test-scm-query-string.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -43,7 +43,7 @@
 
     q2 = gnc_scm2query (res_q);
 
-    if (!xaccQueryEqual (q, q2))
+    if (!qof_query_equal (q, q2))
     {
         failure ("queries don't match");
         fprintf (stderr, "%s\n\n", str2 ? str2 : "(null)");
@@ -58,7 +58,7 @@
         success ("queries match");
     }
     if (str2) g_free(str2);
-    if (q2) xaccFreeQuery (q2);
+    if (q2) qof_query_destroy (q2);
 }
 
 static void
@@ -75,7 +75,7 @@
     {
         q = get_random_query ();
         test_query (q, val2str);
-        xaccFreeQuery (q);
+        qof_query_destroy (q);
         printf("%d ", i);
         fflush(stdout);
     }
@@ -83,7 +83,7 @@
     {
         q = get_random_query ();
         test_query (q, val2str);
-        xaccFreeQuery (q);
+        qof_query_destroy (q);
         printf("%d ", i);
         fflush(stdout);
     }

Modified: gnucash/trunk/src/backend/xml/io-gncxml-v1.c
===================================================================
--- gnucash/trunk/src/backend/xml/io-gncxml-v1.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/backend/xml/io-gncxml-v1.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -2337,7 +2337,7 @@
                             gpointer *result, const gchar *tag, gchar **attrs)
 {
     Query *q;
-    q = xaccMallocQuery();
+    q = qof_query_create_for(GNC_ID_SPLIT);
     g_return_val_if_fail(q, FALSE);
     *data_for_children = q;
     *result = q;
@@ -2363,16 +2363,16 @@
     g_return_val_if_fail(qand, FALSE);
 
     /* append the and terms by or'ing them in ... */
-    qret = xaccQueryMerge (q, qand, QUERY_OR);
+    qret = qof_query_merge (q, qand, QUERY_OR);
     if (!qret)
     {
-        xaccFreeQuery(qand);
+        qof_query_destroy(qand);
         *result = q;
         g_return_val_if_fail(qret, FALSE);
     }
 
-    xaccFreeQuery(q);
-    xaccFreeQuery(qand);
+    qof_query_destroy(q);
+    qof_query_destroy(qand);
 
     *result = qret;
     return(TRUE);
@@ -2402,7 +2402,7 @@
                            const gchar *tag)
 {
     Query *q = (Query *) data_for_children;
-    if (q) xaccFreeQuery(q);
+    if (q) qof_query_destroy(q);
 }
 
 /* ================================================================= */
@@ -2434,7 +2434,7 @@
     Query *q;
 
     /* note this malloc freed in the node higher up (query_restore_end_handler) */
-    q = xaccMallocQuery();
+    q = qof_query_create_for(GNC_ID_SPLIT);
     g_return_val_if_fail(q, FALSE);
     *data_for_children = q;
     *result = q;
@@ -2463,7 +2463,7 @@
                        const gchar *tag)
 {
     Query *q = (Query *) data_for_children;
-    if (q) xaccFreeQuery(q);
+    if (q) qof_query_destroy(q);
 }
 
 /* ================================================================= */

Modified: gnucash/trunk/src/engine/Query.c
===================================================================
--- gnucash/trunk/src/engine/Query.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/Query.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -65,7 +65,7 @@
 SplitList *
 xaccQueryGetSplitsUniqueTrans(Query *q)
 {
-    GList       * splits = xaccQueryGetSplits(q);
+    GList       * splits = qof_query_run(q);
     GList       * current;
     GList       * result = NULL;
     GHashTable  * trans_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -117,7 +117,7 @@
 TransList *
 xaccQueryGetTransactions (Query * q, query_txn_match_t runtype)
 {
-    GList       * splits = xaccQueryGetSplits(q);
+    GList       * splits = qof_query_run(q);
     GList       * current = NULL;
     GList       * retval = NULL;
     GHashTable  * trans_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -188,7 +188,7 @@
 LotList *
 xaccQueryGetLots (Query * q, query_txn_match_t runtype)
 {
-    GList       * splits = xaccQueryGetSplits(q);
+    GList       * splits = qof_query_run(q);
     GList       * current = NULL;
     GList       * retval = NULL;
     GHashTable  * lot_hash = g_hash_table_new(g_direct_hash, g_direct_equal);

Modified: gnucash/trunk/src/engine/Query.h
===================================================================
--- gnucash/trunk/src/engine/Query.h	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/Query.h	2010-10-13 16:16:04 UTC (rev 19652)
@@ -39,30 +39,6 @@
 
 typedef QofQuery Query;
 
-#define xaccMallocQuery()	qof_query_create_for(GNC_ID_SPLIT)
-#define xaccFreeQuery		qof_query_destroy
-#define xaccQueryCopy		qof_query_copy
-#define xaccQuerySetBook	qof_query_set_book
-
-#define xaccQueryInvert		qof_query_invert
-#define xaccQueryMerge		qof_query_merge
-#define xaccQueryClear		qof_query_clear
-
-/* The xaccQueryHasTerms() routine returns the number of 'OR' terms in the query.
- * The xaccQueryNumTerms() routine returns the total number of terms in the query.
- */
-
-#define xaccQueryHasTerms	qof_query_has_terms
-#define xaccQueryNumTerms	qof_query_num_terms
-
-
-#define xaccQuerySetSortIncreasing	qof_query_set_sort_increasing
-
-#define xaccQuerySetMaxSplits	qof_query_set_max_results
-#define xaccQueryGetMaxSplits	qof_query_get_max_results
-
-#define xaccQueryEqual		qof_query_equal
-
 typedef enum
 {
     QUERY_TXN_MATCH_ALL = 1, /* match all accounts */
@@ -77,21 +53,23 @@
  *    query.  Any given split will appear at most once in the result;
  *    however, several splits from one transaction may appear in the list.
  *    The caller MUST NOT change the GList.
- *
+ */
+
+/**
  * The xaccQueryGetSplitsUniqueTrans() routine returns splits matching
  *    the query, but only one matching split per transaction will be
  *    returned.  In other words, any given transaction will be
  *    represented at most once in the returned list.  The caller must
  *    free the GList.
- *
+ */
+SplitList   * xaccQueryGetSplitsUniqueTrans(Query *q);
+
+/**
  * The xaccQueryGetTransactions() routine returns a list of
  *    transactions that match the query.  The GList must be freed by
  *    the caller. The query_run_t argument is used to provide account
  *    matching in the following way:
  *
- * The xaccQueryGetLots() routine is just like GetTransactions() except
- *    it returns a list of Lots.
- *
  *    query_txn_match_t describes how to match accounts when querying
  *    for transactions with xaccQueryGetTransactions().
  *    What is the difference between 'ANY' and 'ALL', you
@@ -107,9 +85,13 @@
  *    matching accounts, whereas 'AND' acts as a boolean-AND
  *    for matching accounts.  Whew. Got that?
  */
-#define xaccQueryGetSplits	qof_query_run
-SplitList   * xaccQueryGetSplitsUniqueTrans(Query *q);
 TransList   * xaccQueryGetTransactions(Query * q, query_txn_match_t type);
+
+/**
+ * The xaccQueryGetLots() routine is just like GetTransactions() except
+ *    it returns a list of Lots.
+ *
+ */
 LotList     * xaccQueryGetLots(Query * q, query_txn_match_t type);
 
 /*******************************************************************

Modified: gnucash/trunk/src/engine/engine-helpers.c
===================================================================
--- gnucash/trunk/src/engine/engine-helpers.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/engine-helpers.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -1181,7 +1181,7 @@
         query_term_scm = SCM_CDR (query_term_scm);
         sense = scm_is_true (scm);
 
-        q = xaccMallocQuery ();
+        q = qof_query_create_for(GNC_ID_SPLIT);
 
         if (!safe_strcmp (pd_type, "pd-date"))
         {
@@ -1497,14 +1497,14 @@
             out_q = q;
         else
         {
-            out_q = xaccQueryInvert (q);
-            xaccFreeQuery (q);
+            out_q = qof_query_invert (q);
+            qof_query_destroy (q);
         }
 
         return out_q;
     }
 
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
     return NULL;
 }
 
@@ -1577,11 +1577,11 @@
 
             if (q_and)
             {
-                q_new = xaccQueryMerge (q, q_and, QOF_QUERY_AND);
+                q_new = qof_query_merge (q, q_and, QOF_QUERY_AND);
 
                 if (q_new)
                 {
-                    xaccFreeQuery (q);
+                    qof_query_destroy (q);
                     q = q_new;
                 }
             }
@@ -1599,7 +1599,7 @@
     if (!scm_is_list (or_terms))
         return NULL;
 
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
 
     while (!scm_is_null (or_terms))
     {
@@ -1619,11 +1619,11 @@
 
             if (q_or)
             {
-                q_new = xaccQueryMerge (q, q_or, QOF_QUERY_OR);
+                q_new = qof_query_merge (q, q_or, QOF_QUERY_OR);
 
                 if (q_new)
                 {
-                    xaccFreeQuery (q);
+                    qof_query_destroy (q);
                     q = q_new;
                 }
             }
@@ -1907,7 +1907,7 @@
         if (safe_strcmp ("terms", symbol) == 0)
         {
             if (q)
-                xaccFreeQuery (q);
+                qof_query_destroy (q);
 
             q = gnc_scm2query_or_terms (value, gnc_QUERY_v1);
             if (!q)
@@ -1999,12 +1999,12 @@
         qof_query_set_sort_order (q, s1, s2, s3);
         qof_query_set_sort_increasing (q, primary_increasing, secondary_increasing,
                                        tertiary_increasing);
-        xaccQuerySetMaxSplits (q, max_splits);
+        qof_query_set_max_results (q, max_splits);
 
         return q;
     }
 
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
     return NULL;
 }
 
@@ -2058,7 +2058,7 @@
         if (!safe_strcmp ("terms", symbol))
         {
             if (q)
-                xaccFreeQuery (q);
+                qof_query_destroy (q);
 
             q = gnc_scm2query_or_terms (value, gnc_QUERY_v2);
             if (!q)
@@ -2138,7 +2138,7 @@
         return q;
     }
 
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
     return NULL;
 }
 

Modified: gnucash/trunk/src/engine/test/test-query.c
===================================================================
--- gnucash/trunk/src/engine/test/test-query.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/test/test-query.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -39,7 +39,7 @@
     Query *q;
 
     q = make_trans_query (trans, ALL_QT);
-    xaccQuerySetBook (q, book);
+    qof_query_set_book (q, book);
 
     list = xaccQueryGetTransactions (q, QUERY_TXN_MATCH_ANY);
     if (g_list_length (list) != 1)
@@ -59,7 +59,7 @@
     }
 
     success ("found right transaction");
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
     g_list_free (list);
 
     return 0;

Modified: gnucash/trunk/src/engine/test/test-scm-query.c
===================================================================
--- gnucash/trunk/src/engine/test/test-scm-query.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/test/test-scm-query.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -21,7 +21,7 @@
 
     q2 = gnc_scm2query (scm_q);
 
-    if (!xaccQueryEqual (q, q2))
+    if (!qof_query_equal (q, q2))
     {
         failure ("queries don't match");
         scm_display (scm_q, SCM_UNDEFINED);
@@ -36,7 +36,7 @@
         success ("queries match");
     }
 
-    xaccFreeQuery (q2);
+    qof_query_destroy (q2);
 }
 
 static void
@@ -47,15 +47,15 @@
 
     test_query (NULL);
 
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
     test_query (q);
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
 
     for (i = 0; i < 50; i++)
     {
         q = get_random_query ();
         test_query (q);
-        xaccFreeQuery (q);
+        qof_query_destroy (q);
     }
 }
 

Modified: gnucash/trunk/src/engine/test-core/test-engine-stuff.c
===================================================================
--- gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/engine/test-core/test-engine-stuff.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -1721,7 +1721,7 @@
     num_terms = get_random_int_in_range (1, 3);
     if (gnc_engine_debug_random) printf("num_terms = %d", num_terms);
 
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
 
     while (num_terms-- > 0)
     {
@@ -1882,12 +1882,12 @@
     if (gnc_engine_debug_random) printf ("\n");
     set_query_sort (q, get_random_int_in_range (1, BY_NONE));
 
-    xaccQuerySetSortIncreasing (q,
+    qof_query_set_sort_increasing (q,
                                 get_random_boolean (),
                                 get_random_boolean (),
                                 get_random_boolean ());
 
-    xaccQuerySetMaxSplits (q, get_random_int_in_range (-50000, 50000));
+    qof_query_set_max_results (q, get_random_int_in_range (-50000, 50000));
 
     return q;
 }
@@ -2047,7 +2047,7 @@
     if (query_types == RANDOM_QT)
         query_types = get_random_query_type ();
 
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
 
     s = xaccTransGetSplit (trans, 0);
     a = xaccSplitGetAccount (s);
@@ -2121,7 +2121,7 @@
                 break;
             default:
                 failure ("bad reconcile flag");
-                xaccFreeQuery (q);
+                qof_query_destroy (q);
                 return NULL;
             }
 

Modified: gnucash/trunk/src/experimental/cgi-bin/gnc-server.c
===================================================================
--- gnucash/trunk/src/experimental/cgi-bin/gnc-server.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/experimental/cgi-bin/gnc-server.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -348,8 +348,8 @@
         xaccQuerySetGroup (q, root);
 
         /* hack -- limit to 30 splits ... */
-        xaccQuerySetMaxSplits (q, 30);
-        split_list = xaccQueryGetSplits (q);
+        qof_query_set_max_results (q, 30);
+        split_list = qof_query_run (q);
 
         /* poke those splits into an ccount group structure */
         /* XXX not implemented */
@@ -357,7 +357,7 @@
         /* send the account group structure back to the user */
         /* XXX not implemented */
 
-        xaccFreeQuery (q);
+        qof_query_destroy (q);
         g_free (request_bufp);
 
     }

Modified: gnucash/trunk/src/experimental/cgi-bin/hello2.c
===================================================================
--- gnucash/trunk/src/experimental/cgi-bin/hello2.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/experimental/cgi-bin/hello2.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -58,9 +58,9 @@
     root = gnc_book_get_root_account (book);
 
     /* build a query */
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
     xaccQuerySetGroup (q, root);
-    xaccQuerySetMaxSplits (q, 30);
+    qof_query_set_max_results (q, 30);
 
     /* Get everything between some random dates */
     /* In real life, we would use a query as specified by the user */
@@ -68,7 +68,7 @@
                            FALSE, 16, 10, 2010,
                            QUERY_OR);
 
-    split_list = xaccQueryGetSplits (q);
+    split_list = qof_query_run (q);
 
     /* count number of splits */
     i = 0;
@@ -80,9 +80,9 @@
 
     gncxml_write_query_to_buf(q, &bufp, &sz);
     qq = gncxml_read_query (bufp, sz);
-    xaccQuerySetMaxSplits (qq, 30);
+    qof_query_set_max_results (qq, 30);
     xaccQuerySetGroup (qq, root);
-    sl2 = xaccQueryGetSplits (qq);
+    sl2 = qof_query_run (qq);
 
     /* count number of splits */
     ii = 0;
@@ -103,7 +103,7 @@
     printf (" its %d and %d \n", i, ii);
 
     free (bufp);
-    xaccFreeQuery (q);
+    qof_query_destroy (q);
 
 
 bookerrexit:

Modified: gnucash/trunk/src/experimental/cgi-bin/hello3.c
===================================================================
--- gnucash/trunk/src/experimental/cgi-bin/hello3.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/experimental/cgi-bin/hello3.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -93,10 +93,10 @@
             xaccQuerySetGroup (q, root);
 
             /* hack -- limit to 30 splits ... */
-            xaccQuerySetMaxSplits (q, 30);
-            split_list = xaccQueryGetSplits (q);
+            qof_query_set_max_results (q, 30);
+            split_list = qof_query_run (q);
 
-            xaccFreeQuery (q);
+            qof_query_destroy (q);
 
             /* wait for the next request */
             continue;

Modified: gnucash/trunk/src/gnome/dialog-sx-since-last-run.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/gnome/dialog-sx-since-last-run.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -1000,14 +1000,14 @@
     Query *book_query, *guid_query, *query;
     GList *guid_iter;
 
-    book_query = xaccMallocQuery();
-    guid_query = xaccMallocQuery();
-    xaccQuerySetBook(book_query, gnc_get_current_book());
+    book_query = qof_query_create_for(GNC_ID_SPLIT);
+    guid_query = qof_query_create_for(GNC_ID_SPLIT);
+    qof_query_set_book(book_query, gnc_get_current_book());
     for (guid_iter = created_txn_guids; guid_iter != NULL; guid_iter = guid_iter->next)
     {
         xaccQueryAddGUIDMatch(guid_query, (GncGUID*)guid_iter->data, GNC_ID_TRANS, QUERY_OR);
     }
-    query = xaccQueryMerge(book_query, guid_query, QUERY_AND);
+    query = qof_query_merge(book_query, guid_query, QUERY_AND);
 
     // inspired by dialog-find-transactions:do_find_cb:
     ledger = gnc_ledger_display_query(query, SEARCH_LEDGER, REG_STYLE_JOURNAL);
@@ -1016,9 +1016,9 @@
     g_object_set(G_OBJECT(page), "page-name", _("Created Transactions"), NULL);
     gnc_main_window_open_page(NULL, page);
 
-    xaccFreeQuery(query);
-    xaccFreeQuery(book_query);
-    xaccFreeQuery(guid_query);
+    qof_query_destroy(query);
+    qof_query_destroy(book_query);
+    qof_query_destroy(guid_query);
 }
 
 static void

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -2117,7 +2117,7 @@
     else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
     {
         Account *common_acct = NULL, *account;
-        splits = xaccQueryGetSplits(gnc_ledger_display_get_query(priv->ledger));
+        splits = qof_query_run(gnc_ledger_display_get_query(priv->ledger));
         /* Make sure each split is from the same account */
         for (item = splits; item; item = g_list_next(item))
         {
@@ -3056,7 +3056,7 @@
     gnc_suspend_gui_refresh();
     root = gnc_get_current_root_account();
 
-    for (node = xaccQueryGetSplits(query); node; node = node->next)
+    for (node = qof_query_run(query); node; node = node->next)
     {
         split = node->data;
         trans = xaccSplitGetParent(split);
@@ -3112,9 +3112,9 @@
     if (!split)
         return;
 
-    query = xaccMallocQuery ();
+    query = qof_query_create_for(GNC_ID_SPLIT);
 
-    xaccQuerySetBook (query, gnc_get_current_book ());
+    qof_query_set_book (query, gnc_get_current_book ());
 
     xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split),
                            GNC_ID_SPLIT, QUERY_AND);

Modified: gnucash/trunk/src/gnome/reconcile-list.c
===================================================================
--- gnucash/trunk/src/gnome/reconcile-list.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/gnome/reconcile-list.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -141,8 +141,8 @@
     list->list_type = type;
     list->statement_date = statement_date;
 
-    query = xaccMallocQuery();
-    xaccQuerySetBook(query, gnc_get_current_book ());
+    query = qof_query_create_for(GNC_ID_SPLIT);
+    qof_query_set_book(query, gnc_get_current_book ());
 
     include_children = xaccAccountGetReconcileChildrenStatus(account);
     if (include_children)
@@ -177,7 +177,7 @@
 
     if (auto_check)
     {
-        for (splits = xaccQueryGetSplits(query); splits; splits = splits->next)
+        for (splits = qof_query_run(query); splits; splits = splits->next)
         {
             Split *split = splits->data;
             char recn = xaccSplitGetReconcile(split);
@@ -193,7 +193,7 @@
     }
 
     /* Free the query -- we don't need it anymore */
-    xaccFreeQuery(query);
+    qof_query_destroy(query);
 
     return GTK_WIDGET(list);
 }
@@ -649,7 +649,7 @@
 
     print_info = gnc_account_print_info (list->account, FALSE);
 
-    for (splits = xaccQueryGetSplits (list->query); splits; splits = splits->next)
+    for (splits = qof_query_run (list->query); splits; splits = splits->next)
     {
         gnc_numeric amount;
         Timespec ts;

Modified: gnucash/trunk/src/gnome-utils/gnc-query-list.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-query-list.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/gnome-utils/gnc-query-list.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -472,7 +472,7 @@
     }
     if (list->query)
     {
-        xaccFreeQuery(list->query);
+        qof_query_destroy(list->query);
         list->query = NULL;
     }
     if (list->column_params)
@@ -719,7 +719,7 @@
         gncQuerySetSortOrder (list->query, p1, p2, NULL);
     }
 
-    xaccQuerySetSortIncreasing (list->query,
+    qof_query_set_sort_increasing (list->query,
                                 sort_order,
                                 sort_order,
                                 sort_order);

Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/import-export/import-backend.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -778,7 +778,7 @@
                                    gint match_date_hardlimit)
 {
     GList * list_element;
-    Query *query = xaccMallocQuery();
+    Query *query = qof_query_create_for(GNC_ID_SPLIT);
     g_assert (trans_info);
 
     /* Get list of splits of the originating account. */
@@ -793,14 +793,14 @@
             xaccSplitGetAccount (gnc_import_TransInfo_get_fsplit (trans_info));
         time_t download_time = xaccTransGetDate (gnc_import_TransInfo_get_trans (trans_info));
 
-        xaccQuerySetBook (query, gnc_get_current_book());
+        qof_query_set_book (query, gnc_get_current_book());
         xaccQueryAddSingleAccountMatch (query, importaccount,
                                         QOF_QUERY_AND);
         xaccQueryAddDateMatchTT (query,
                                  TRUE, download_time - match_date_hardlimit * 86400,
                                  TRUE, download_time + match_date_hardlimit * 86400,
                                  QOF_QUERY_AND);
-        list_element = xaccQueryGetSplits (query);
+        list_element = qof_query_run (query);
         /* Sigh. Doesnt help too much. We still create and run one query
            for each imported transaction. Maybe it would improve
            performance further if there is one single (master-)query at
@@ -825,7 +825,7 @@
         list_element = g_list_next (list_element);
     }
 
-    xaccFreeQuery (query);
+    qof_query_destroy (query);
 }
 
 

Modified: gnucash/trunk/src/register/ledger-core/gnc-ledger-display.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/gnc-ledger-display.c	2010-10-13 16:11:44 UTC (rev 19651)
+++ gnucash/trunk/src/register/ledger-core/gnc-ledger-display.c	2010-10-13 16:16:04 UTC (rev 19652)
@@ -413,9 +413,9 @@
 
     ENTER(" ");
 
-    query = xaccMallocQuery ();
+    query = qof_query_create_for(GNC_ID_SPLIT);
 
-    xaccQuerySetBook (query, gnc_get_current_book());
+    qof_query_set_book (query, gnc_get_current_book());
 
     /* In lieu of not "mis-using" some portion of the infrastructure by writing
      * a bunch of new code, we just filter out the accounts of the template
@@ -472,10 +472,10 @@
     acct = NULL;
     isTemplateModeTrue = TRUE;
 
-    q = xaccMallocQuery ();
+    q = qof_query_create_for(GNC_ID_SPLIT);
 
     book = gnc_get_current_book ();
-    xaccQuerySetBook (q, book);
+    qof_query_set_book (q, book);
 
     if ( id != NULL )
     {
@@ -612,7 +612,7 @@
     gnc_split_register_destroy (ld->reg);
     ld->reg = NULL;
 
-    xaccFreeQuery (ld->query);
+    qof_query_destroy (ld->query);
     ld->query = NULL;
 
     g_free (ld);
@@ -643,17 +643,17 @@
         return;
     }
 
-    xaccFreeQuery (ld->query);
-    ld->query = xaccMallocQuery ();
+    qof_query_destroy (ld->query);
+    ld->query = qof_query_create_for(GNC_ID_SPLIT);
 
     /* This is a bit of a hack. The number of splits should be
      * configurable, or maybe we should go back a time range instead
      * of picking a number, or maybe we should be able to exclude
      * based on reconciled status. Anyway, this works for now. */
     if ((limit != 0) && (type != SEARCH_LEDGER))
-        xaccQuerySetMaxSplits (ld->query, limit);
+        qof_query_set_max_results (ld->query, limit);
 
-    xaccQuerySetBook (ld->query, gnc_get_current_book());
+    qof_query_set_book (ld->query, gnc_get_current_book());
 
     leader = gnc_ledger_display_leader (ld);
 
@@ -778,7 +778,7 @@
 
     /* set up the query filter */
     if (q)
-        ld->query = xaccQueryCopy (q);
+        ld->query = qof_query_copy (q);
     else
         gnc_ledger_display_make_query (ld, limit, reg_type);
 
@@ -813,8 +813,8 @@
 
     g_return_if_fail (ledger_display->ld_type == LD_GL);
 
-    xaccFreeQuery (ledger_display->query);
-    ledger_display->query = xaccQueryCopy (q);
+    qof_query_destroy (ledger_display->query);
+    ledger_display->query = qof_query_copy (q);
 }
 
 GNCLedgerDisplay *
@@ -864,7 +864,7 @@
         return;
     }
 
-    gnc_ledger_display_refresh_internal (ld, xaccQueryGetSplits (ld->query));
+    gnc_ledger_display_refresh_internal (ld, qof_query_run (ld->query));
     LEAVE(" ");
 }
 



More information about the gnucash-changes mailing list