Added new functions for atom entry.
[cascardo/atompub.git] / atom / entry.c
index c0fed59..c1385d1 100644 (file)
@@ -31,8 +31,28 @@ Atom *
 atom_new_data_len (char *data, size_t len)
 {
   Atom *atom = g_slice_new (Atom);
-  atom->data = data;
+  atom->data = g_malloc (len);
+  memcpy (atom->data, data, len);
   atom->len = len;
   return atom;
 }
 
+void
+atom_delete (Atom *atom)
+{
+  if (atom->data)
+    g_free (atom->data);
+  g_slice_free (Atom, atom);
+}
+
+char *
+atom_string (Atom *atom)
+{
+  return atom->data;
+}
+
+size_t
+atom_len (Atom *atom)
+{
+  return atom->len;
+}