aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-04-26 09:22:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-04-26 09:22:21 +0800
commit42aa29e62e19d6b5d466dcc946de227252ca948a (patch)
tree9a2dbd160154a83968b92a6c38d7063cb11b08c6
parent7d9faeb00c03ec6af1c9f7f378123b57a9804de6 (diff)
downloadgsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar.gz
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar.bz2
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar.lz
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar.xz
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.tar.zst
gsoc2013-evolution-42aa29e62e19d6b5d466dcc946de227252ca948a.zip
Blah blah fix for xml1 broken utf8 encoding, and use "g" memory for all
2001-04-26 Not Zed <NotZed@Ximian.com> * filter-part.c (filter_part_xml_create): Blah blah fix for xml1 broken utf8 encoding, and use "g" memory for all allocations. (filter_part_finalise): Free our data properly. svn path=/trunk/; revision=9572
-rw-r--r--filter/ChangeLog6
-rw-r--r--filter/filter-part.c46
2 files changed, 36 insertions, 16 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 43f8f5610f..8cb76fbe7d 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,9 @@
+2001-04-26 Not Zed <NotZed@Ximian.com>
+
+ * filter-part.c (filter_part_xml_create): Blah blah fix for xml1
+ broken utf8 encoding, and use "g" memory for all allocations.
+ (filter_part_finalise): Free our data properly.
+
2001-04-20 Kjartan Maraas <kmaraas@gnome.org>
* filter-rule.c: Pull up fix for translation of filter
diff --git a/filter/filter-part.c b/filter/filter-part.c
index f23df4d437..59e6c7da73 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -101,8 +101,21 @@ static void
filter_part_finalise(GtkObject *obj)
{
FilterPart *o = (FilterPart *)obj;
-
+ GList *l;
+
o = o;
+
+ l = o->elements;
+ while (l) {
+ gtk_object_unref((GtkObject *)l->data);
+ l = g_list_next(l);
+ }
+
+ g_list_free(o->elements);
+ g_free(o->name);
+ g_free(o->title);
+ g_free(o->code);
+
((GtkObjectClass *)(parent_class))->finalize(obj);
}
@@ -143,10 +156,13 @@ int
filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
{
xmlNodePtr n;
- char *type;
+ char *type, *str, *decstr;
FilterElement *el;
- ff->name = xmlGetProp(node, "name");
+ str = xmlGetProp(node, "name");
+ ff->name = g_strdup(str);
+ if (str)
+ xmlFree(str);
n = node->childs;
while (n) {
if (!strcmp (n->name, "input")) {
@@ -155,27 +171,25 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
if (type != NULL
&& (el = filter_element_new_type_name (type)) != NULL) {
filter_element_xml_create (el, n);
- xmlFree (type);
+ xmlFree(type);
d(printf ("adding element part %p %s\n", ff, el, el->name));
ff->elements = g_list_append (ff->elements, el);
} else {
g_warning ("Invalid xml format, missing/unknown input type");
}
- } else if (!strcmp (n->name, "title")) {
+ } else if (!strcmp(n->name, "title")) {
if (!ff->title) {
- gchar *str, *decstr;
str = xmlNodeGetContent (n);
- decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
- ff->title = decstr;
+ ff->title = e_utf8_xml1_decode (str);
+ if (str)
+ xmlFree (str);
}
} else if (!strcmp (n->name, "code")) {
if (!ff->code) {
- gchar *str, *decstr;
str = xmlNodeGetContent (n);
- decstr = e_utf8_xml1_decode (str);
- if (str) xmlFree (str);
- ff->code = decstr;
+ ff->code = e_utf8_xml1_decode (str);
+ if (str)
+ xmlFree (str);
}
} else {
g_warning ("Unknwon part element in xml: %s\n", n->name);
@@ -245,9 +259,9 @@ filter_part_clone (FilterPart *fp)
FilterElement *fe, *ne;
new = (FilterPart *)gtk_type_new ((GTK_OBJECT (fp))->klass->type);
- new->name = g_strdup (fp->name);
- new->title = g_strdup (fp->title);
- new->code = g_strdup (fp->code);
+ new->name = g_strdup(fp->name);
+ new->title = g_strdup(fp->title);
+ new->code = g_strdup(fp->code);
l = fp->elements;
while (l) {
fe = l->data;