r21587 - gnucash/trunk/src - [Cruft Reduction] Remove unused functions in src/engine -- reprise
John Ralls
jralls at code.gnucash.org
Sat Nov 19 17:42:02 EST 2011
Author: jralls
Date: 2011-11-19 17:42:02 -0500 (Sat, 19 Nov 2011)
New Revision: 21587
Trac: http://svn.gnucash.org/trac/changeset/21587
Modified:
gnucash/trunk/src/engine/Account.c
gnucash/trunk/src/engine/Account.h
gnucash/trunk/src/engine/Split.c
gnucash/trunk/src/engine/gncEmployee.c
gnucash/trunk/src/engine/gncJob.c
gnucash/trunk/src/engine/gncVendor.c
gnucash/trunk/src/engine/test/utest-Account.c
gnucash/trunk/src/optional/python-bindings/gnucash_core.py
Log:
[Cruft Reduction] Remove unused functions in src/engine -- reprise
Delete a bunch more functions left commented out from r21579
Remove references to deleted functions from gnucash_core.py
Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/Account.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -1504,14 +1504,6 @@
/********************************************************************\
\********************************************************************/
-/*
-gboolean
-gnc_account_get_sort_dirty (Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
- return GET_PRIVATE(acc)->sort_dirty;
-}
-*/
void
gnc_account_set_sort_dirty (Account *acc)
{
@@ -1525,14 +1517,7 @@
priv = GET_PRIVATE(acc);
priv->sort_dirty = TRUE;
}
-/*
-gboolean
-gnc_account_get_balance_dirty (Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
- return GET_PRIVATE(acc)->balance_dirty;
-}
-*/
+
void
gnc_account_set_balance_dirty (Account *acc)
{
@@ -1549,21 +1534,7 @@
/********************************************************************\
\********************************************************************/
-/*
-gboolean
-gnc_account_find_split (Account *acc, Split *s)
-{
- AccountPrivate *priv;
- GList *node;
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
- g_return_val_if_fail(GNC_IS_SPLIT(s), FALSE);
-
- priv = GET_PRIVATE(acc);
- node = g_list_find(priv->splits, s);
- return node ? TRUE : FALSE;
-}
-*/
gboolean
gnc_account_insert_split (Account *acc, Split *s)
{
@@ -1682,15 +1653,7 @@
/********************************************************************\
\********************************************************************/
-/*
-short
-xaccAccountGetMark (const Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), 0);
- return GET_PRIVATE(acc)->mark;
-}
-*/
void
xaccAccountSetMark (Account *acc, short m)
{
@@ -2812,30 +2775,7 @@
thunk (node->data, user_data);
}
}
-/*
-gpointer
-gnc_account_foreach_child_until (const Account *acc,
- AccountCb2 thunk,
- gpointer user_data)
-{
- const AccountPrivate *priv;
- GList *node;
- gpointer result;
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), NULL);
- g_return_val_if_fail(thunk, NULL);
-
- priv = GET_PRIVATE(acc);
- for (node = priv->children; node; node = node->next)
- {
- result = thunk (node->data, user_data);
- if (result)
- return(result);
- }
-
- return NULL;
-}
-*/
void
gnc_account_foreach_descendant (const Account *acc,
AccountCb thunk,
@@ -3036,15 +2976,6 @@
/********************************************************************\
\********************************************************************/
-/*
-gnc_numeric
-gnc_account_get_start_balance (Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
-
- return GET_PRIVATE(acc)->starting_balance;
-}
-*/
void
gnc_account_set_start_balance (Account *acc, const gnc_numeric start_baln)
{
@@ -3056,15 +2987,7 @@
priv->starting_balance = start_baln;
priv->balance_dirty = TRUE;
}
-/*
-gnc_numeric
-gnc_account_get_start_cleared_balance (Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
- return GET_PRIVATE(acc)->starting_cleared_balance;
-}
-*/
void
gnc_account_set_start_cleared_balance (Account *acc,
const gnc_numeric start_baln)
@@ -3077,15 +3000,7 @@
priv->starting_cleared_balance = start_baln;
priv->balance_dirty = TRUE;
}
-/*
-gnc_numeric
-gnc_account_get_start_reconciled_balance (Account *acc)
-{
- g_return_val_if_fail(GNC_IS_ACCOUNT(acc), gnc_numeric_zero());
- return GET_PRIVATE(acc)->starting_reconciled_balance;
-}
-*/
void
gnc_account_set_start_reconciled_balance (Account *acc,
const gnc_numeric start_baln)
@@ -3993,25 +3908,7 @@
if (type < 0 || NUM_ACCOUNT_TYPES <= type ) return "";
return _(account_type_name [type]);
}
-/*
-GNCAccountType
-xaccAccountGetTypeFromStr (const gchar *str)
-{
- gint type;
- for (type = 0; type < NUM_ACCOUNT_TYPES; type++)
- {
- if (!safe_strcmp (str, _(account_type_name [type])))
- return type;
- }
-
- PERR("asked to translate unknown account type string %s.\n",
- str ? str : "(null)");
-
- return ACCT_TYPE_INVALID;
-}
-*/
-
/********************************************************************\
\********************************************************************/
@@ -4633,15 +4530,7 @@
return FALSE;
}
-/*
-gboolean
-xaccSplitTransactionTraverse (Split *split, int stage)
-{
- if (split == NULL) return FALSE;
- return xaccTransactionTraverse (split->parent, stage);
-}
-*/
static void do_one_split (Split *s, gpointer data)
{
Transaction *trans = s->parent;
Modified: gnucash/trunk/src/engine/Account.h
===================================================================
--- gnucash/trunk/src/engine/Account.h 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/Account.h 2011-11-19 22:42:02 UTC (rev 21587)
@@ -350,16 +350,6 @@
* @param acc Set the flag on this account. */
void gnc_account_set_sort_dirty (Account *acc);
-/** Find the given split in an account.
- *
- * @param acc The account whose splits are to be searched.
- *
- * @param s The split to be found.
- *
- * @result TRUE is the split is found in the accounts list of splits.
- * FALSE otherwise.
-gboolean gnc_account_find_split (Account *acc, Split *s);
-*/
/** Insert the given split from an account.
*
* @param acc The account to which the split should be added.
@@ -400,35 +390,7 @@
const char * xaccAccountGetLastNum (const Account *account);
/** Get the account's lot order policy */
GNCPolicy *gnc_account_get_policy (Account *account);
-/** Retrieve the starting commodity balance for this account.
-gnc_numeric gnc_account_get_start_balance (Account *acc);
-*/
-/** Retrieve the starting cleared commodity balance for this
- * account.
-gnc_numeric gnc_account_get_start_cleared_balance (Account *acc);
-*/
-/** Retrieve the starting reconciled commodity balance for this
- * account.
-gnc_numeric gnc_account_get_start_reconciled_balance (Account *acc);
-*/
-/** Get an indication of whether the account believes that the running
- * balances may be incorrect and need to be recomputed.
- *
- * @param acc Retrieve the flag on this account.
- *
- * @return TRUE if the running account balances need to be recomputed.
- * FALSE if they are correct.
-gboolean gnc_account_get_balance_dirty (Account *acc);
-*/
-/** Get an indication of whether the account believes that the splits
- * may be incorrectly sorted and need to be resorted.
- *
- * @param acc Retrieve the flag on this account.
- *
- * @return TRUE if the splits in the account need to be resorted.
- * FALSE if the sort order is correct.
-gboolean gnc_account_get_sort_dirty (Account *acc);
-*/
+
/** The following recompute the partial balances (stored with the
* transaction) and the total balance, for this account
*/
@@ -822,25 +784,6 @@
void gnc_account_foreach_child (const Account *account,
AccountCb func, /*@ null @*/ gpointer user_data);
-/** This method will traverse the immediate children of this accounts,
- * calling 'func' on each account. Traversal will stop when func
- * returns a non-null value, and the routine will return with that
- * value. Therefore, this function will return null if func returns
- * null for every account. For a simpler function that always
- * traverses all children nodes, use the gnc_account_foreach_child()
- * function.
- *
- * @param account A pointer to the account on whose children the
- * function should be called.
- *
- * @param func A function taking two arguments, an Account and a
- * gpointer.
- *
- * @param user_data This data will be passed to each call of func.
-gpointer gnc_account_foreach_child_until (const Account *account,
- AccountCb2 func, gpointer user_data);
-*/
-
/** This method will traverse all children of this accounts and their
* descendants, calling 'func' on each account. This function
* traverses all descendant nodes. To traverse only a subset of the
@@ -973,11 +916,7 @@
* use in the GUI/Interface. These strings should be translated
* to the local language. */
const char * xaccAccountGetTypeStr (GNCAccountType type);
-/** The xaccAccountGetTypeStr() routine returns a string suitable for
- * use in the GUI/Interface. These strings should be translated
- * to the local language.
-GNCAccountType xaccAccountGetTypeFromStr (const gchar *str);
-*/
+
/** Return the bitmask of parent account types compatible with a given type. */
guint32 xaccParentAccountTypesCompatibleWith (GNCAccountType type);
@@ -1325,11 +1264,6 @@
*/
gboolean xaccTransactionTraverse(Transaction *trans, int stage);
-/** xaccSplitTransactionTraverse() behaves as above using the parent of
- * the given split.
- *
-gboolean xaccSplitTransactionTraverse(Split *split, int stage);
-*/
/** xaccAccountStagedTransactionTraversal() calls @a thunk on each
* transaction in account @a a whose current marker is less than the
* given @a stage and updates each transaction's marker to be @a stage.
Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/Split.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -1135,69 +1135,6 @@
/********************************************************************\
\********************************************************************/
-/* gnc_numeric */
-/* xaccSplitsComputeValue (GList *splits, const Split * skip_me, */
-/* const gnc_commodity * base_currency) */
-/* { */
-/* GList *node; */
-/* gnc_numeric value = gnc_numeric_zero(); */
-
-/* g_return_val_if_fail (base_currency, value); */
-
-/* ENTER (" currency=%s", gnc_commodity_get_mnemonic (base_currency)); */
-
-/* for (node = splits; node; node = node->next) */
-/* { */
-/* const Split *s = node->data; */
-/* const gnc_commodity *currency; */
-/* const gnc_commodity *commodity; */
-
-/* if (s == skip_me) continue; */
-
-/* /\* value = gnc_numeric_add(value, xaccSplitGetBaseValue(s, base_currency), */
-/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); *\/ */
-
-/* /\* The split-editor often sends us 'temp' splits whose account */
-/* * hasn't yet been set. Be lenient, and assume an implied base */
-/* * currency. If there's a problem later, the scrub routines will */
-/* * pick it up. */
-/* *\/ */
-/* commodity = s->acc ? xaccAccountGetCommodity (s->acc) : base_currency; */
-/* currency = xaccTransGetCurrency (s->parent); */
-
-
-/* if (gnc_commodity_equiv(currency, base_currency)) */
-/* { */
-/* value = gnc_numeric_add(value, xaccSplitGetValue(s), */
-/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); */
-/* } */
-/* else if (gnc_commodity_equiv(commodity, base_currency)) */
-/* { */
-/* value = gnc_numeric_add(value, xaccSplitGetAmount(s), */
-/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); */
-/* } */
-/* else */
-/* { */
-/* PERR ("inconsistent currencies\n" */
-/* "\tbase = '%s', curr='%s', sec='%s'\n", */
-/* gnc_commodity_get_printname(base_currency), */
-/* gnc_commodity_get_printname(currency), */
-/* gnc_commodity_get_printname(commodity)); */
-/* g_return_val_if_fail (FALSE, value); */
-/* } */
-/* } */
-
-/* /\* Note that just because the currencies are equivalent */
-/* * doesn't mean the denominators are the same! *\/ */
-/* value = gnc_numeric_convert(value, */
-/* gnc_commodity_get_fraction (base_currency), */
-/* GNC_HOW_RND_ROUND_HALF_UP); */
-
-/* LEAVE (" total=%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT, */
-/* value.num, value.denom); */
-/* return value; */
-/* } */
-
gnc_numeric
xaccSplitConvertAmount (const Split *split, const Account * account)
{
Modified: gnucash/trunk/src/engine/gncEmployee.c
===================================================================
--- gnucash/trunk/src/engine/gncEmployee.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/gncEmployee.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -146,20 +146,6 @@
}
}
-/** Get displayable name */
-/*
-static gchar*
-impl_get_display_name(const QofInstance* inst)
-{
- GncEmployee* emp;
-
- g_return_val_if_fail(inst != NULL, FALSE);
- g_return_val_if_fail(GNC_IS_EMPLOYEE(inst), FALSE);
-
- emp = GNC_EMPLOYEE(inst);
- return g_strdup_printf("Employee %s", emp->username);
-}
-*/
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)
Modified: gnucash/trunk/src/engine/gncJob.c
===================================================================
--- gnucash/trunk/src/engine/gncJob.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/gncJob.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -483,20 +483,6 @@
gncJobFree(job);
}
-/** Handles book end - frees all jobs from the book
- *
- * @param book Book being closed
- */
-/*
-static void
-gnc_job_book_end(QofBook* book)
-{
- QofCollection *col;
-
- col = qof_book_get_collection(book, GNC_ID_JOB);
- qof_collection_foreach(col, destroy_job_on_book_close, NULL);
-}
-*/
static QofObject gncJobDesc =
{
DI(.interface_version = ) QOF_OBJECT_VERSION,
Modified: gnucash/trunk/src/engine/gncVendor.c
===================================================================
--- gnucash/trunk/src/engine/gncVendor.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/gncVendor.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -152,20 +152,6 @@
}
}
-/** Return displayable name */
-/*
-static gchar*
-impl_get_display_name(const QofInstance* inst)
-{
- GncVendor* v;
-
- g_return_val_if_fail(inst != NULL, FALSE);
- g_return_val_if_fail(GNC_IS_VENDOR(inst), FALSE);
-
- v = GNC_VENDOR(inst);
- return g_strdup_printf("Vendor %s", v->name);
-}
-*/
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)
Modified: gnucash/trunk/src/engine/test/utest-Account.c
===================================================================
--- gnucash/trunk/src/engine/test/utest-Account.c 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/engine/test/utest-Account.c 2011-11-19 22:42:02 UTC (rev 21587)
@@ -974,7 +974,8 @@
gnc_account_set_balance_dirty
*/
/* gnc_account_find_split *** Test Only ***
-/ * gnc_account_insert_split
+ */
+/* gnc_account_insert_split
gboolean
gnc_account_insert_split (Account *acc, Split *s)// C: 5 in 3
@@ -1715,11 +1716,8 @@
* xaccAccountGetColor
* xaccAccountGetNotes
* xaccAccountGetCommodity
- * gnc_account_get_start_balance *** Test Only ***
* gnc_account_set_start_balance
- * gnc_account_get_start_cleared_balance *** Test Only ***
* gnc_account_set_start_cleared_balance
- * gnc_account_get_start_reconciled_balance *** Test Only ***
* gnc_account_set_start_reconciled_balance
* xaccAccountGetBalance
* xaccAccountGetClearedBalance C: 1
@@ -1977,8 +1975,7 @@
/* xaccAccountTypeEnumAsString
* xaccAccountStringToType
* xaccAccountStringToEnum
- * xaccAccountGetTypeStr *** Not Used ***
- * xaccAccountGetTypeFromStr *** Test Only ***
+ * xaccAccountGetTypeStr
* xaccAccountIsPriced
const char *
xaccAccountTypeEnumAsString (GNCAccountType type)// C: 5 in 3 */
@@ -2030,7 +2027,6 @@
}
else
g_assert_cmpstr (typestr_uc, ==, typename);
-// g_assert_cmpint (xaccAccountGetTypeFromStr (typestr), ==, type);
g_free (typestr_uc);
g_object_set (acc, "type", type, NULL);
@@ -2163,7 +2159,7 @@
*/
/* finder_help_function
static void
-finder_help_function (const Account *acc, const char *descrption,// 3
+finder_help_function (const Account *acc, const char *description,// 3
Helper function, fully exercised by the following two public functions
*/
/* xaccAccountFindSplitByDesc
@@ -2404,7 +2400,6 @@
GNC_TEST_ADD (suitename, "gnc account lookup by full name helper", Fixture, &complex, setup, test_gnc_account_lookup_by_full_name_helper, teardown );
GNC_TEST_ADD (suitename, "gnc account lookup by full name", Fixture, &complex, setup, test_gnc_account_lookup_by_full_name, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach child", Fixture, &complex, setup, test_gnc_account_foreach_child, teardown );
-// GNC_TEST_ADD (suitename, "gnc account foreach child until", Fixture, &complex, setup, test_gnc_account_foreach_child_until, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach descendant", Fixture, &complex, setup, test_gnc_account_foreach_descendant, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach descendant until", Fixture, &complex, setup, test_gnc_account_foreach_descendant_until, teardown );
GNC_TEST_ADD (suitename, "gnc account get full name", Fixture, &good_data, setup, test_gnc_account_get_full_name, teardown );
Modified: gnucash/trunk/src/optional/python-bindings/gnucash_core.py
===================================================================
--- gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2011-11-19 22:41:41 UTC (rev 21586)
+++ gnucash/trunk/src/optional/python-bindings/gnucash_core.py 2011-11-19 22:42:02 UTC (rev 21587)
@@ -315,7 +315,6 @@
'lookup_latest_before' : GncPrice,
'convert_balance_latest_price' : GncNumeric,
'convert_balance_nearest_price' : GncNumeric,
- 'convert_balance_latest_before' : GncNumeric,
}
methods_return_instance(GncPriceDB,PriceDB_dict)
GncPriceDB.get_prices = method_function_returns_instance_list(
@@ -615,8 +614,6 @@
'lookup_by_full_name' : Account,
'FindTransByDesc' : Transaction,
'FindSplitByDesc' : Split,
- 'get_start_balance' : GncNumeric,
- 'get_start_cleared_balance' : GncNumeric,
'GetBalance' : GncNumeric,
'GetClearedBalance' : GncNumeric,
'GetReconciledBalance' : GncNumeric,
@@ -666,4 +663,4 @@
class Query(GnuCashCoreClass):
pass
-Query.add_constructor_and_methods_with_prefix('qof_query_', 'create')
\ No newline at end of file
+Query.add_constructor_and_methods_with_prefix('qof_query_', 'create')
More information about the gnucash-changes
mailing list