Allow passing NULL path to sokoke_hostname_from_uri
This commit is contained in:
parent
48c2681115
commit
6331573a2c
1 changed files with 8 additions and 3 deletions
|
@ -503,7 +503,7 @@ sokoke_spawn_app (const gchar* uri)
|
||||||
/**
|
/**
|
||||||
* sokoke_hostname_from_uri:
|
* sokoke_hostname_from_uri:
|
||||||
* @uri: an URI string
|
* @uri: an URI string
|
||||||
* @path: location of a string pointer
|
* @path: location of a string, or %NULL
|
||||||
*
|
*
|
||||||
* Returns the hostname of the specified URI.
|
* Returns the hostname of the specified URI.
|
||||||
*
|
*
|
||||||
|
@ -519,10 +519,15 @@ sokoke_hostname_from_uri (const gchar* uri,
|
||||||
|
|
||||||
if ((hostname = strchr (uri, '/')))
|
if ((hostname = strchr (uri, '/')))
|
||||||
{
|
{
|
||||||
|
gchar* pathname;
|
||||||
if (hostname[1] == '/')
|
if (hostname[1] == '/')
|
||||||
hostname += 2;
|
hostname += 2;
|
||||||
if ((*path = strchr (hostname, '/')))
|
if ((pathname = strchr (hostname, '/')))
|
||||||
return g_strndup (hostname, *path - hostname);
|
{
|
||||||
|
if (path != NULL)
|
||||||
|
*path = pathname;
|
||||||
|
return g_strndup (hostname, pathname - hostname);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return g_strdup (hostname);
|
return g_strdup (hostname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue