[goffice] Formats: same treatment for _go_format_currencies.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Formats: same treatment for _go_format_currencies.
- Date: Mon, 12 Aug 2013 01:36:18 +0000 (UTC)
commit a48a598633d3e19793b3f12251db31c8817ca99e
Author: Morten Welinder <terra gnome org>
Date: Sun Aug 11 21:35:52 2013 -0400
Formats: same treatment for _go_format_currencies.
ChangeLog | 6 +++---
goffice/gtk/go-format-sel.c | 8 ++++----
goffice/utils/formats.c | 8 +++++++-
goffice/utils/go-format.c | 8 ++++----
goffice/utils/go-format.h | 3 +--
5 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 35327c5..2c706c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,8 @@
2013-08-11 Morten Welinder <terra gnome org>
- * goffice/utils/formats.c (_go_format_builtins): Change from
- variable to function. Improve C standard compliance in the
- process.
+ * goffice/utils/formats.c (_go_format_builtins)
+ (_go_format_currencies): Change from variabless to functions.
+ Improve C standard compliance in the process.
2013-08-09 Jean Brefort <jean brefort normalesup org>
diff --git a/goffice/gtk/go-format-sel.c b/goffice/gtk/go-format-sel.c
index c04409b..ddab987 100644
--- a/goffice/gtk/go-format-sel.c
+++ b/goffice/gtk/go-format-sel.c
@@ -1252,8 +1252,8 @@ cb_format_currency_select (GtkComboBoxText *combo, GOFormatSel *gfs)
return FALSE;
}
- for (i = 0; _go_format_currencies[i].symbol != NULL ; ++i) {
- GOFormatCurrency const *ci = _go_format_currencies + i;
+ for (i = 0; _go_format_currencies ()[i].symbol != NULL ; ++i) {
+ GOFormatCurrency const *ci = _go_format_currencies () + i;
if (!strcmp (_(ci->description), new_text)) {
gfs->format.details.currency = ci;
break;
@@ -1655,8 +1655,8 @@ nfs_init (GOFormatSel *gfs)
GtkEntry *entry =
GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo)));
- for (i = 0; _go_format_currencies[i].symbol != NULL ; ++i)
- l = g_slist_prepend (l, _((gchar *)_go_format_currencies[i].description));
+ for (i = 0; _go_format_currencies ()[i].symbol != NULL ; ++i)
+ l = g_slist_prepend (l, _((gchar *)_go_format_currencies ()[i].description));
l = g_slist_sort (l, funny_currency_order);
for (ptr = l; ptr != NULL ; ptr = ptr->next)
diff --git a/goffice/utils/formats.c b/goffice/utils/formats.c
index a9bedc9..c5dabb3 100644
--- a/goffice/utils/formats.c
+++ b/goffice/utils/formats.c
@@ -365,7 +365,7 @@ _go_currency_date_format_shutdown (void)
}
}
-GOFormatCurrency const _go_format_currencies[] =
+static GOFormatCurrency const _go_format_currencies_table[] =
{
{ "", N_("None"), TRUE, FALSE }, /* These first six elements */
{ "$", "$", TRUE, FALSE }, /* Must stay in this order */
@@ -562,3 +562,9 @@ GOFormatCurrency const _go_format_currencies[] =
{ NULL, NULL, FALSE, FALSE }
};
+
+
+GOFormatCurrency const *_go_format_currencies (void)
+{
+ return &_go_format_currencies_table[0];
+}
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index f35c636..a116da4 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -6765,7 +6765,7 @@ go_format_generate_accounting_str (GString *dst,
GOFormatCurrency const *currency = details->currency;
if (!currency)
- currency = &_go_format_currencies[0];
+ currency = _go_format_currencies ();
symstr = currency->symbol;
switch (g_utf8_get_char (symstr)) {
@@ -6835,7 +6835,7 @@ go_format_generate_currency_str (GString *dst,
GOFormatCurrency const *currency = details->currency;
if (!currency)
- currency = &_go_format_currencies[0];
+ currency = _go_format_currencies ();
extra_quotes = (details->force_quoted &&
currency->symbol[0] != '"' &&
@@ -6893,8 +6893,8 @@ find_currency (char const *ptr, gsize len, gboolean precedes)
quoted = len > 2 && ptr[0] == '\"' && ptr[len - 1] == '\"';
- for (i = 1; _go_format_currencies[i].symbol; i++) {
- const GOFormatCurrency *ci = _go_format_currencies + i;
+ for (i = 1; _go_format_currencies ()[i].symbol; i++) {
+ const GOFormatCurrency *ci = _go_format_currencies() + i;
if (ci->precedes != precedes)
continue;
diff --git a/goffice/utils/go-format.h b/goffice/utils/go-format.h
index 5034cd3..61b9751 100644
--- a/goffice/utils/go-format.h
+++ b/goffice/utils/go-format.h
@@ -273,8 +273,7 @@ void go_format_foreach (GHFunc func, gpointer user_data);
/*************************************************************************/
char const * const *_go_format_builtins(GOFormatFamily fam);
-
-GO_VAR_DECL GOFormatCurrency const _go_format_currencies [];
+GOFormatCurrency const *_go_format_currencies (void);
GOFormatCurrency const *go_format_locale_currency (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]