Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 237881 Details for
Bug 353121
[PATCH] ignore duplicate SpellError objects
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
ignore duplicates when adding spelling error objects to a line's spell_errors list
no-spell-dupes.patch (text/plain), 3.18 KB, created by
Dan Williams
on 2007-10-25 19:40:13 UTC
(
hide
)
Description:
ignore duplicates when adding spelling error objects to a line's spell_errors list
Filename:
MIME Type:
Creator:
Dan Williams
Created:
2007-10-25 19:40:13 UTC
Size:
3.18 KB
patch
obsolete
>diff -up gtkhtml-3.14.3/src/htmltext.c.ignore-spell-dupes gtkhtml-3.14.3/src/htmltext.c >--- gtkhtml-3.14.3/src/htmltext.c.ignore-spell-dupes 2007-10-25 15:18:31.000000000 -0400 >+++ gtkhtml-3.14.3/src/htmltext.c 2007-10-25 15:29:07.000000000 -0400 >@@ -67,6 +67,7 @@ static void spell_error_destroy > static void move_spell_errors (GList *spell_errors, guint offset, gint delta); > static GList * remove_spell_errors (GList *spell_errors, guint offset, guint len); > static void remove_text_slaves (HTMLObject *self); >+static gboolean spell_errors_list_add (GList **spell_errors, SpellError *se); > > /* void > debug_spell_errors (GList *se) >@@ -508,6 +509,7 @@ object_merge (HTMLObject *self, HTMLObje > { > HTMLText *t1, *t2; > gchar *to_free; >+ GList *iter; > > t1 = HTML_TEXT (self); > t2 = HTML_TEXT (with); >@@ -528,7 +530,12 @@ object_merge (HTMLObject *self, HTMLObje > printf ("---\n"); > */ > move_spell_errors (t2->spell_errors, 0, t1->text_len); >- t1->spell_errors = g_list_concat (t1->spell_errors, t2->spell_errors); >+ for (iter = t2->spell_errors; iter; iter = g_list_next (iter)) { >+ SpellError *se = (SpellError *) iter->data; >+ if (!spell_errors_list_add (&t1->spell_errors, se)) >+ spell_error_destroy (se); >+ } >+ g_list_free (t2->spell_errors); > t2->spell_errors = NULL; > > pango_attr_list_splice (t1->attr_list, t2->attr_list, t1->text_bytes, t2->text_bytes); >@@ -3055,27 +3062,63 @@ html_text_spell_errors_clear_interval (H > } > } > >-static gint >-se_cmp (gconstpointer a, gconstpointer b) >+/* Returns TRUE if 'se' was added, FALSE if 'se' was not added (duplicate, etc) */ >+static gboolean >+spell_errors_list_add (GList **spell_errors, SpellError *se) > { >- guint o1, o2; >+ GList *iter; >+ gboolean added = FALSE; > >- o1 = ((SpellError *) a)->off; >- o2 = ((SpellError *) b)->off; >+ if (*spell_errors == NULL) { >+ *spell_errors = g_list_append (*spell_errors, se); >+ goto added; >+ } > >- if (o1 < o2) return -1; >- if (o1 == o2) return 0; >- return 1; >+ for (iter = *spell_errors; iter; iter = g_list_next (iter)) { >+ SpellError *list_se = (SpellError *) iter->data; >+ SpellError *list_next_se; >+ >+ /* Ignore duplicates */ >+ if (se->off == list_se->off && se->len == list_se->len) >+ goto out; >+ >+ if (!iter->next) { >+ /* Add item at end of list */ >+ GList *node = g_list_append (NULL, se); >+ node->next = NULL; >+ node->prev = iter; >+ iter->next = node; >+ break; >+ } >+ >+ list_next_se = (SpellError *) iter->next->data; >+ if (list_next_se->off > se->off) { >+ /* Insert the item at this point in the list */ >+ GList *node = g_list_append (NULL, se); >+ node->next = iter->next; >+ node->prev = iter; >+ node->next->prev = node; >+ iter->next = node; >+ break; >+ } >+ } >+ >+added: >+ added = TRUE; >+ >+out: >+ return added; > } > > void > html_text_spell_errors_add (HTMLText *text, guint off, guint len) > { >+ SpellError *se = spell_error_new (off, len); > /* GList *cur; >- SpellError *se; > cur = */ > >- text->spell_errors = g_list_insert_sorted (text->spell_errors, spell_error_new (off, len), se_cmp); >+ if (!spell_errors_list_add (&text->spell_errors, se)) >+ spell_error_destroy (se); > > /* printf ("---------------------------------------\n"); > while (cur) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 353121
: 237881