[patch 04/15] [account.diff] Adding const to Account accessor function arguments

c.shoemaker at cox.net c.shoemaker at cox.net
Mon Oct 10 10:34:26 EDT 2005


  * src/engine/Account.[ch]
  * src/app-utils/gnc-ui-util.c:
  * src/backend/file/io-example-aacount.c:
  * src/backend/file/io-gncxml-v2.c:
    - adding const to Account accessor function arguments


 src/app-utils/gnc-ui-util.c           |    4 ++--
 src/backend/file/io-example-account.c |    2 +-
 src/backend/file/io-gncxml-v2.c       |    4 ++--
 src/engine/Account.c                  |   10 +++++-----
 src/engine/Account.h                  |   10 +++++-----
 5 files changed, 15 insertions(+), 15 deletions(-)

Index: gnucash/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash.orig/src/app-utils/gnc-ui-util.c
+++ gnucash/src/app-utils/gnc-ui-util.c
@@ -1001,8 +1001,8 @@ gnc_commodity_print_info (const gnc_comm
 
 static GNCPrintAmountInfo
 gnc_account_print_info_helper(Account *account, gboolean use_symbol,
-                              gnc_commodity * (*efffunc)(Account *),
-                              int (*scufunc)(Account*))
+                              gnc_commodity * (*efffunc)(const Account *),
+                              int (*scufunc)(const Account*))
 {
   GNCPrintAmountInfo info;
   gboolean is_iso;
Index: gnucash/src/backend/file/io-example-account.c
===================================================================
--- gnucash.orig/src/backend/file/io-example-account.c
+++ gnucash/src/backend/file/io-example-account.c
@@ -91,7 +91,7 @@ gnc_destroy_example_account(GncExampleAc
 static void
 clear_up_account_commodity(
     gnc_commodity_table *tbl, Account *act,
-    gnc_commodity * (*getter) (Account *account),
+    gnc_commodity * (*getter) (const Account *account),
     void (*setter) (Account *account, gnc_commodity *comm))
 {
     gnc_commodity *gcom;
Index: gnucash/src/backend/file/io-gncxml-v2.c
===================================================================
--- gnucash.orig/src/backend/file/io-gncxml-v2.c
+++ gnucash/src/backend/file/io-gncxml-v2.c
@@ -75,9 +75,9 @@ run_callback(sixtp_gdv2 *data, const cha
 static void
 clear_up_account_commodity(
     gnc_commodity_table *tbl, Account *act,
-    gnc_commodity * (*getter) (Account *account),
+    gnc_commodity * (*getter) (const Account *account),
     void (*setter) (Account *account, gnc_commodity *comm),
-    int (*scu_getter) (Account *account),
+    int (*scu_getter) (const Account *account),
     void (*scu_setter) (Account *account, int scu))
 {
     gnc_commodity *gcom;
Index: gnucash/src/engine/Account.c
===================================================================
--- gnucash.orig/src/engine/Account.c
+++ gnucash/src/engine/Account.c
@@ -1351,7 +1351,7 @@ xaccAccountSetCommoditySCU (Account *acc
 }
 
 int
-xaccAccountGetCommoditySCUi (Account * acc) 
+xaccAccountGetCommoditySCUi (const Account * acc)
 {
   if (!acc) return 0;
 
@@ -1359,7 +1359,7 @@ xaccAccountGetCommoditySCUi (Account * a
 }
 
 int
-xaccAccountGetCommoditySCU (Account * acc) 
+xaccAccountGetCommoditySCU (const Account * acc)
 {
   if (!acc) return 0;
 
@@ -1383,7 +1383,7 @@ xaccAccountSetNonStdSCU (Account *acc, g
 }
 
 gboolean
-xaccAccountGetNonStdSCU (Account * acc) 
+xaccAccountGetNonStdSCU (const Account * acc)
 {
   if (!acc) return 0;
 
@@ -1563,7 +1563,7 @@ xaccAccountGetNotes (Account *acc) 
 }
 
 gnc_commodity * 
-DxaccAccountGetCurrency (Account *acc)
+DxaccAccountGetCurrency (const Account *acc)
 {
   KvpValue *v;
   const char *s;
@@ -1583,7 +1583,7 @@ DxaccAccountGetCurrency (Account *acc)
 }
 
 gnc_commodity * 
-xaccAccountGetCommodity (Account *acc)
+xaccAccountGetCommodity (const Account *acc)
 {
   if (!acc) return NULL;
 
Index: gnucash/src/engine/Account.h
===================================================================
--- gnucash.orig/src/engine/Account.h
+++ gnucash/src/engine/Account.h
@@ -303,7 +303,7 @@ void xaccAccountSetCommodity (Account *a
 #define DxaccAccountSetSecurity xaccAccountSetCommodity
 
 /** Get the account's commodity  */
-gnc_commodity * xaccAccountGetCommodity (Account *account);
+gnc_commodity * xaccAccountGetCommodity (const Account *account);
 
 /** @deprecated do not use */
 #define DxaccAccountGetSecurity xaccAccountGetCommodity
@@ -312,11 +312,11 @@ gnc_commodity * xaccAccountGetCommodity 
  *   set for the account, that is returned; else the default SCU for
  *   the account commodity is returned.
  */
-int  xaccAccountGetCommoditySCU (Account *account);
+int  xaccAccountGetCommoditySCU (const Account *account);
 
 /** Return the 'internal' SCU setting.  This returns the over-ride
  *   SCU for the account (which might not be set, and might be zero).  */
-int  xaccAccountGetCommoditySCUi (Account *account);
+int  xaccAccountGetCommoditySCUi (const Account *account);
 
 /** Set the SCU for the account. Normally, this routine is not
  *   required, as the default SCU for an account is given by its
@@ -332,7 +332,7 @@ void  xaccAccountSetNonStdSCU (Account *
 
 /** Return boolean, indicating whether this account uses a 
  *   non-standard SCU. */ 
-gboolean  xaccAccountGetNonStdSCU (Account *account);
+gboolean  xaccAccountGetNonStdSCU (const Account *account);
 /**@}*/
 
 
@@ -733,7 +733,7 @@ void DxaccAccountSetCurrency (Account *a
 /** @deprecated The current API associates only one thing with an
  * account: the 'commodity'. Use xaccAccountGetCommodity() to fetch
  * it. */
-gnc_commodity * DxaccAccountGetCurrency (Account *account);
+gnc_commodity * DxaccAccountGetCurrency (const Account *account);
 
 /** Set the timezone to be used when interpreting the results from a
  *  given Finance::Quote backend.  Unfortunately, the upstream sources

--


More information about the gnucash-devel mailing list