Added function to release IRI memory.
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sun, 27 Jan 2008 03:32:48 +0000 (01:32 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Sun, 27 Jan 2008 03:32:48 +0000 (01:32 -0200)
include/atompub/iri.h
iri/iri.c

index c2e09ee..0135916 100644 (file)
@@ -24,7 +24,8 @@
 
 typedef struct _iri IRI;
 
-IRI * iri_new ();
+IRI * iri_new (void);
+void iri_delete (IRI *);
 char * iri_get_path (IRI *);
 void iri_set_path (IRI *, char *);
 
index d60a853..47b79ac 100644 (file)
--- a/iri/iri.c
+++ b/iri/iri.c
@@ -39,6 +39,18 @@ iri_new ()
   return iri;
 }
 
+void
+iri_delete (IRI *iri)
+{
+  if (iri->scheme)
+    g_free (iri->scheme);
+  if (iri->host)
+    g_free (iri->host);
+  if (iri->path)
+    g_free (iri->path);
+  g_slice_free (IRI, iri);
+}
+
 char *
 iri_get_path (IRI *iri)
 {
@@ -52,4 +64,3 @@ iri_set_path (IRI *iri, char *path)
     g_free (iri->path);
   iri->path = g_strdup (path);
 }
-