Replace uriIsHostSetA() by local implementation

Even though uriIsHostSetA() is exported by the uriparser library, it is
not in a header file, so it's not part of the official interface, and
its use causes compiler warnings.  So create a local copy and use that.

closes #2
This commit is contained in:
Peter Eisentraut 2015-08-27 23:44:40 -04:00
parent 8a02974787
commit cf854ebea1
1 changed files with 16 additions and 1 deletions

17
uri.c
View File

@ -221,6 +221,21 @@ uri_fragment(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
/*
* Defined in uriparser library, but not exported, so we keep a local version
* here.
*/
static bool
_is_host_set(UriUriA *uri)
{
return (uri != NULL)
&& ((uri->hostText.first != NULL)
|| (uri->hostData.ip4 != NULL)
|| (uri->hostData.ip6 != NULL)
|| (uri->hostData.ipFuture.first != NULL)
);
}
PG_FUNCTION_INFO_V1(uri_path);
Datum
uri_path(PG_FUNCTION_ARGS)
@ -235,7 +250,7 @@ uri_path(PG_FUNCTION_ARGS)
parse_uri(s, &uri);
if (uri.absolutePath || (uriIsHostSetA(&uri) && uri.pathHead))
if (uri.absolutePath || (_is_host_set(&uri) && uri.pathHead))
appendStringInfoChar(&buf, '/');
for (p = uri.pathHead; p; p = p->next)