From 6331573a2c9ec16fcf0ba082e362fbbbcfb49416 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 12 Oct 2010 23:02:44 +0200 Subject: [PATCH] Allow passing NULL path to sokoke_hostname_from_uri --- midori/sokoke.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index e2babcc0..4add49a7 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -503,7 +503,7 @@ sokoke_spawn_app (const gchar* uri) /** * sokoke_hostname_from_uri: * @uri: an URI string - * @path: location of a string pointer + * @path: location of a string, or %NULL * * Returns the hostname of the specified URI. * @@ -519,10 +519,15 @@ sokoke_hostname_from_uri (const gchar* uri, if ((hostname = strchr (uri, '/'))) { + gchar* pathname; if (hostname[1] == '/') hostname += 2; - if ((*path = strchr (hostname, '/'))) - return g_strndup (hostname, *path - hostname); + if ((pathname = strchr (hostname, '/'))) + { + if (path != NULL) + *path = pathname; + return g_strndup (hostname, pathname - hostname); + } else return g_strdup (hostname); }