When parsing an entry, create a new ID object and copy the others
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Thu, 27 Nov 2008 04:27:26 +0000 (02:27 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Thu, 27 Nov 2008 04:27:26 +0000 (02:27 -0200)
When parsing the entry, the strings were not copied and the ID was a
string and not an ID object.

atom/entry.c

index 99ab439..c7c2b0a 100644 (file)
@@ -75,15 +75,15 @@ atom_entry_new_data_len (char *data, size_t len)
       char * content;
       content = xmlNodeGetContent (child->xmlChildrenNode);
       if (!xmlStrcmp (child->name, "id"))
-       entry->id = content;
+        entry->id = atom_id_new (content);
       else if (!xmlStrcmp (child->name, "title"))
-       entry->title = content;
+        entry->title = g_strdup (content);
       else if (!xmlStrcmp (child->name, "summary"))
-       entry->summary = content;
+        entry->summary = g_strdup (content);
       else if (!xmlStrcmp (child->name, "author"))
-       atom_entry_author_add (entry, atom_person_new_from_xmlnode (child));
+        atom_entry_author_add (entry, atom_person_new_from_xmlnode (child));
       else
-       xmlFree (content);
+        xmlFree (content);
     }
   return entry;
 }
@@ -94,7 +94,7 @@ atom_entry_delete (AtomEntry *entry)
   if (entry->doc)
     xmlFreeDoc (entry->doc);
   if (entry->id)
-    g_free (entry->id);
+    atom_id_delete (entry->id);
   if (entry->title)
     g_free (entry->title);
   if (entry->authors)