From bfd8a73f004b95d044741f4cb78ecad9de92bddc Mon Sep 17 00:00:00 2001 From: Xavier Saint Date: Sat, 2 Aug 2008 11:22:14 +0200 Subject: [PATCH] quote*() functions don't like that much NULL arg --- src/iri.c | 9 +++++---- src/recur.c | 2 +- src/retr.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/iri.c b/src/iri.c index 3ee99871..9050e858 100644 --- a/src/iri.c +++ b/src/iri.c @@ -318,6 +318,7 @@ iri_new (void) i->uri_encoding = opt.encoding_remote ? xstrdup (opt.encoding_remote) : NULL; i->content_encoding = NULL; i->utf8_encode = opt.enable_iri; + return i; } void @@ -331,12 +332,12 @@ iri_free (struct iri *i) void set_uri_encoding (struct iri *i, char *charset, bool force) { - DEBUGP (("[IRI uri = `%s'\n", quote (charset))); + DEBUGP (("[IRI uri = `%s'\n", charset ? quote (charset) : "None")); if (!force && opt.encoding_remote) return; if (i->uri_encoding) { - if (!strcasecmp (i->uri_encoding, charset)) + if (charset && !strcasecmp (i->uri_encoding, charset)) return; xfree (i->uri_encoding); } @@ -347,12 +348,12 @@ set_uri_encoding (struct iri *i, char *charset, bool force) void set_content_encoding (struct iri *i, char *charset) { - DEBUGP (("[IRI content = %s\n", quote (charset))); + DEBUGP (("[IRI content = %s\n", charset ? quote (charset) : "None")); if (opt.encoding_remote) return; if (i->content_encoding) { - if (!strcasecmp (i->content_encoding, charset)) + if (charset && !strcasecmp (i->content_encoding, charset)) return; xfree (i->content_encoding); } diff --git a/src/recur.c b/src/recur.c index 19ef8f1c..baeaed58 100644 --- a/src/recur.c +++ b/src/recur.c @@ -117,7 +117,7 @@ url_enqueue (struct url_queue *queue, struct iri *i, if (i) DEBUGP (("[IRI Enqueuing %s with %s\n", quote (url), - quote (i->uri_encoding))); + i->uri_encoding ? quote (i->uri_encoding) : "None")); if (queue->tail) queue->tail->next = qel; diff --git a/src/retr.c b/src/retr.c index 111b745a..fa7f762d 100644 --- a/src/retr.c +++ b/src/retr.c @@ -636,7 +636,8 @@ retrieve_url (const char *origurl, char **file, char **newloc, } DEBUGP (("[IRI Retrieving %s with %s (UTF-8=%d)\n", quote (url), - quote (iri->uri_encoding), iri->utf8_encode)); + iri->uri_encoding ? quote (iri->uri_encoding) : "None", + iri->utf8_encode)); if (!refurl) refurl = opt.referer;