summaryrefslogtreecommitdiffstats
path: root/lib/url/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url/url.c')
-rw-r--r--lib/url/url.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/url/url.c b/lib/url/url.c
index 1e69774..42bd4a1 100644
--- a/lib/url/url.c
+++ b/lib/url/url.c
@@ -242,18 +242,21 @@ static bool is_url(const char *str)
return strstr(str, "://") != NULL;
}
-static void pb_url_update_full(struct pb_url *url)
+char *pb_url_to_string(struct pb_url *url)
{
const struct pb_scheme_info *scheme = pb_url_scheme_info(url->scheme);
-
assert(scheme);
- talloc_free(url->full);
-
- url->full = talloc_asprintf(url, "%s://%s%s", scheme->str,
+ return talloc_asprintf(url, "%s://%s%s", scheme->str,
scheme->has_host ? url->host : "", url->path);
}
+static void pb_url_update_full(struct pb_url *url)
+{
+ talloc_free(url->full);
+ url->full = pb_url_to_string(url);
+}
+
static struct pb_url *pb_url_copy(void *ctx, const struct pb_url *url)
{
struct pb_url *new_url;
OpenPOWER on IntegriCloud