From a8cc26772831b3fc1ed9a6e1308447cc6126aa8b Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sat, 26 Jan 2008 21:36:19 -0200 Subject: [PATCH] More functions for IRI manipulation. --- include/atompub/iri.h | 2 ++ iri/iri.c | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/atompub/iri.h b/include/atompub/iri.h index ffc377e..c2e09ee 100644 --- a/include/atompub/iri.h +++ b/include/atompub/iri.h @@ -24,6 +24,8 @@ typedef struct _iri IRI; +IRI * iri_new (); char * iri_get_path (IRI *); +void iri_set_path (IRI *, char *); #endif diff --git a/iri/iri.c b/iri/iri.c index 55803f4..d60a853 100644 --- a/iri/iri.c +++ b/iri/iri.c @@ -19,6 +19,8 @@ #include +#include + struct _iri { char *scheme; @@ -26,10 +28,28 @@ struct _iri char *path; }; +IRI * +iri_new () +{ + IRI *iri; + iri = g_slice_new (IRI); + iri->scheme = NULL; + iri->host = NULL; + iri->path = NULL; + return iri; +} + char * iri_get_path (IRI *iri) { return iri->path; } -#endif +void +iri_set_path (IRI *iri, char *path) +{ + if (iri->path) + g_free (iri->path); + iri->path = g_strdup (path); +} + -- 2.20.1