Use AtomID instead of string consistently in entry
[cascardo/atompub.git] / atom / entry.c
index c7c2b0a..99a4172 100644 (file)
@@ -26,7 +26,7 @@
 struct _atom_entry
 {
   xmlDocPtr doc;
-  char *id;
+  AtomID *id;
   char *title;
   GPtrArray *authors;
   char *summary;
@@ -104,18 +104,18 @@ atom_entry_delete (AtomEntry *entry)
   g_slice_free (AtomEntry, entry);
 }
 
-char *
+AtomID *
 atom_entry_id (AtomEntry *entry)
 {
   return entry->id;
 }
 
 void
-atom_entry_id_set (AtomEntry *entry, char *id)
+atom_entry_id_set (AtomEntry *entry, AtomID *id)
 {
   if (entry->id)
-    g_free (entry->id);
-  entry->id = g_strdup (id);
+    atom_id_delete (entry->id);
+  entry->id = id;
 }
 
 char *
@@ -211,7 +211,7 @@ atom_entry_update_xmlnode (AtomEntry *entry)
           child = next;
         }
     }
-  id = xmlNewTextChild (root, NULL, "id", entry->id);
+  id = xmlNewTextChild (root, NULL, "id", atom_id_string (entry->id));
   title = xmlNewTextChild (root, NULL, "title", entry->title);
   if (entry->summary)
     summary = xmlNewTextChild (root, NULL, "summary", entry->summary);