1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-08-20 20:54:47 -04:00

URI: Inline check_uri_file.

And reorder the characters in the string given to strcspn(), to match
their expected order in the URI.  This is also how strcspn() is called
elsewhere in uri.c.
This commit is contained in:
Kalle Olavi Niemitalo 2007-06-17 19:50:05 +03:00 committed by Witold Filipczyk
parent b2b4e67e0d
commit cb1658f399

View File

@ -145,15 +145,6 @@ check_whether_file_exists(unsigned char *name)
return -1;
}
static int
check_uri_file(const unsigned char *name)
{
/* Check POST_CHAR etc ... */
static const unsigned char chars[] = POST_CHAR_S "#";
return strcspn(name, chars);
}
/* Encodes URIs without encoding stuff like fragments and query separators. */
static void
encode_file_uri_string(struct string *string, unsigned char *uristring)
@ -240,7 +231,7 @@ parse_uri(struct uri *uri, unsigned char *uristring)
return URI_ERRNO_OK;
} else if (uri->protocol == PROTOCOL_FILE) {
int datalen = check_uri_file(prefix_end);
int datalen = strcspn(prefix_end, "#" POST_CHAR_S);
unsigned char *frag_or_post = prefix_end + datalen;
/* Extract the fragment part. */
@ -256,6 +247,7 @@ parse_uri(struct uri *uri, unsigned char *uristring)
} else {
datalen = strlen(prefix_end);
}
/* A bit of a special case, but using the "normal" host
* parsing seems a bit scary at this point. (see bug 107). */
if (datalen > 9 && !strncasecmp(prefix_end, "localhost/", 10)) {