[Xfce4-commits] <midori:master> Allow passing NULL path to sokoke_hostname_from_uri

Christian Dywan noreply at xfce.org
Wed Oct 13 03:24:03 CEST 2010


Updating branch refs/heads/master
         to 6331573a2c9ec16fcf0ba082e362fbbbcfb49416 (commit)
       from 48c268111560dc27c7eadabd2768429ba1f5d8e3 (commit)

commit 6331573a2c9ec16fcf0ba082e362fbbbcfb49416
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Oct 12 23:02:44 2010 +0200

    Allow passing NULL path to sokoke_hostname_from_uri

 midori/sokoke.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/midori/sokoke.c b/midori/sokoke.c
index e2babcc..4add49a 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);
     }



More information about the Xfce4-commits mailing list