[goffice] Format: cache rich-text formats.



commit 8025b3d6ab58587d019da57181fa45e358b73d54
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 17 15:02:55 2017 -0400

    Format: cache rich-text formats.
    
    This matters because go_format_eq assumes caching.

 ChangeLog                 |    5 +++++
 NEWS                      |    3 +++
 goffice/utils/go-format.c |   30 +++++++++++++++---------------
 3 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1ee30fa..e654ac4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-17  Morten Welinder  <terra gnome org>
+
+       * goffice/utils/go-format.c (go_format_new_from_XL): Cache also
+       rich-text formats.
+
 2017-01-29  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index be6b054..c39d2ba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.10.34:
 
+Morten:
+       * Fix rich-text format problem.
+
 --------------------------------------------------------------------------
 goffice 0.10.33:
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index e2ba401..0954c2b 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -6194,23 +6194,23 @@ go_format_new_from_XL (char const *str)
 
        g_return_val_if_fail (str != NULL, go_format_general ());
 
-       if (str[0] == '@' && str[1] == '[') {
-               PangoAttrList *attrs;
-               char *desc_copy = g_strdup (str);
-               attrs = go_format_parse_markup (desc_copy);
-               if (attrs) {
-                       format = go_format_create (GO_FMT_MARKUP, str);
-                       format->u.markup = attrs;
-               } else
-                       format = go_format_create (GO_FMT_INVALID, str);
-
-               g_free (desc_copy);
-               return format;
-       }
-
        format = g_hash_table_lookup (style_format_hash, str);
+
        if (format == NULL) {
-               format = go_format_parse (str);
+               if (str[0] == '@' && str[1] == '[') {
+                       PangoAttrList *attrs;
+                       char *desc_copy = g_strdup (str);
+                       attrs = go_format_parse_markup (desc_copy);
+                       if (attrs) {
+                               format = go_format_create (GO_FMT_MARKUP, str);
+                               format->u.markup = attrs;
+                       } else
+                               format = go_format_create (GO_FMT_INVALID, str);
+
+                       g_free (desc_copy);
+               } else
+                       format = go_format_parse (str);
+
                g_hash_table_insert (style_format_hash,
                                     format->format,
                                     format);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]