From cf854ebea173994bd2f607e5b7e231d4419b517c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 27 Aug 2015 23:44:40 -0400 Subject: [PATCH] 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 --- uri.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/uri.c b/uri.c index a2baeaa..3fad2e1 100644 --- a/uri.c +++ b/uri.c @@ -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)