From: Thadeu Lima de Souza Cascardo Date: Sat, 26 Jan 2008 23:36:19 +0000 (-0200) Subject: More functions for IRI manipulation. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fatompub.git;a=commitdiff_plain;h=a8cc26772831b3fc1ed9a6e1308447cc6126aa8b More functions for IRI manipulation. --- 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); +} +