X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Firi.c;fp=src%2Firi.c;h=1803ca710698f19048be43dcfb1164bbbede182d;hp=b1e0bf89cd9bc2a9caf55e2e533f1cc2b6a23d12;hb=44cde778dd4fe171e168ab7aff97b285b190b4d5;hpb=47e7d242ff3902c35544830cb34c172a6700247d diff --git a/src/iri.c b/src/iri.c index b1e0bf89..1803ca71 100644 --- a/src/iri.c +++ b/src/iri.c @@ -295,7 +295,7 @@ remote_to_utf8 (struct iri *i, const char *str, const char **new) struct iri * iri_new (void) { - struct iri *i = xmalloc (sizeof (struct iri)); + struct iri *i = xmalloc (sizeof *i); i->uri_encoding = opt.encoding_remote ? xstrdup (opt.encoding_remote) : NULL; i->content_encoding = NULL; i->orig_url = NULL; @@ -303,6 +303,17 @@ iri_new (void) return i; } +struct iri *iri_dup (const struct iri *src) +{ + struct iri *i = xmalloc (sizeof *i); + i->uri_encoding = src->uri_encoding ? xstrdup (src->uri_encoding) : NULL; + i->content_encoding = (src->content_encoding ? + xstrdup (src->content_encoding) : NULL); + i->orig_url = src->orig_url ? xstrdup (src->orig_url) : NULL; + i->utf8_encode = src->utf8_encode; + return i; +} + /* Completely free an iri structure. */ void iri_free (struct iri *i)