X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Furl%2Furl.c;h=7202f4965414be300cd9e1c5cb0ee8ea68c3c29b;hp=42bd4a1afb0e3e5bae5c8db61e2d316d06234c92;hb=66bf929fa97fabb70198455f9eec2e9ccf0661fa;hpb=d9a54dc81723f83a21e24aa362a7a356d266e942 diff --git a/lib/url/url.c b/lib/url/url.c index 42bd4a1..7202f49 100644 --- a/lib/url/url.c +++ b/lib/url/url.c @@ -20,9 +20,7 @@ #include "config.h" #endif -#define _GNU_SOURCE #include -#include #include #include "log/log.h" @@ -162,8 +160,6 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str) struct pb_url *url; const char *p; - pb_log("%s: '%s'\n", __func__, url_str); - if (!url_str || !*url_str) { assert(0 && "bad url"); return NULL; @@ -223,13 +219,6 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str) pb_url_parse_path(url); - pb_log(" scheme %d\n", url->scheme); - pb_log(" host '%s'\n", url->host); - pb_log(" port '%s'\n", url->port); - pb_log(" path '%s'\n", url->path); - pb_log(" dir '%s'\n", url->dir); - pb_log(" file '%s'\n", url->file); - return url; fail: @@ -237,7 +226,7 @@ fail: return NULL; } -static bool is_url(const char *str) +bool is_url(const char *str) { return strstr(str, "://") != NULL; } @@ -263,13 +252,13 @@ static struct pb_url *pb_url_copy(void *ctx, const struct pb_url *url) new_url = talloc(ctx, struct pb_url); new_url->scheme = url->scheme; - new_url->full = talloc_strdup(url, url->full); + new_url->full = talloc_strdup(new_url, url->full); - new_url->host = url->host ? talloc_strdup(url, url->host) : NULL; - new_url->port = url->port ? talloc_strdup(url, url->port) : NULL; - new_url->path = url->path ? talloc_strdup(url, url->path) : NULL; - new_url->dir = url->dir ? talloc_strdup(url, url->dir) : NULL; - new_url->file = url->file ? talloc_strdup(url, url->file) : NULL; + new_url->host = url->host ? talloc_strdup(new_url, url->host) : NULL; + new_url->port = url->port ? talloc_strdup(new_url, url->port) : NULL; + new_url->path = url->path ? talloc_strdup(new_url, url->path) : NULL; + new_url->dir = url->dir ? talloc_strdup(new_url, url->dir) : NULL; + new_url->file = url->file ? talloc_strdup(new_url, url->file) : NULL; return new_url; }