mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-27 08:50:02 +03:00
Remove url_parent.
This commit is contained in:
parent
639d2cb659
commit
aeac82ff17
49
utils/url.c
49
utils/url.c
@ -482,55 +482,6 @@ url_func_result url_canonical_root(const char *url, char **result)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Strip the topmost segment of the path
|
||||
*
|
||||
* \param url an absolute URL
|
||||
* \param result pointer to pointer to buffer to hold result
|
||||
* \return URL_FUNC_OK on success
|
||||
*/
|
||||
|
||||
url_func_result url_parent(const char *url, char **result)
|
||||
{
|
||||
url_func_result status;
|
||||
struct url_components components;
|
||||
int len, path_len;
|
||||
|
||||
assert(url);
|
||||
|
||||
status = url_get_components(url, &components);
|
||||
if (status == URL_FUNC_OK) {
|
||||
if ((!components.scheme) || (!components.authority) ||
|
||||
(!components.path)) {
|
||||
status = URL_FUNC_FAILED;
|
||||
} else {
|
||||
if (strcmp(components.path, "/")) {
|
||||
path_len = strlen(components.path);
|
||||
if (components.path[path_len - 1] == '/')
|
||||
path_len--;
|
||||
while (components.path[path_len - 1] != '/')
|
||||
path_len--;
|
||||
} else {
|
||||
path_len = 1;
|
||||
}
|
||||
len = strlen(components.scheme) +
|
||||
strlen(components.authority) +
|
||||
path_len + 4;
|
||||
*result = malloc(len);
|
||||
if (!(*result))
|
||||
status = URL_FUNC_NOMEM;
|
||||
else
|
||||
snprintf((*result), len, "%s://%s%s",
|
||||
components.scheme,
|
||||
components.authority,
|
||||
components.path);
|
||||
}
|
||||
}
|
||||
url_destroy_components(&components);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract path segment from an URL
|
||||
*
|
||||
|
@ -57,7 +57,6 @@ url_func_result url_escape(const char *unescaped, size_t toskip,
|
||||
bool sptoplus, const char *escexceptions, char **result);
|
||||
url_func_result url_unescape(const char *str, char **result);
|
||||
url_func_result url_canonical_root(const char *url, char **result);
|
||||
url_func_result url_parent(const char *url, char **result);
|
||||
url_func_result url_path(const char *url, char **result);
|
||||
url_func_result url_compare(const char *url1, const char *url2,
|
||||
bool nofrag, bool *result);
|
||||
|
Loading…
Reference in New Issue
Block a user