1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05: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 Kalle Olavi Niemitalo
parent 581ef57bb4
commit 0cf15ca9d9

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)) {