1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00

check_uri_file(): use strcspn().

This commit is contained in:
Laurent MONIN 2006-01-08 19:06:46 +01:00 committed by Laurent MONIN
parent 67a89e1454
commit 8fe7eb0357

View File

@ -150,18 +150,8 @@ check_uri_file(unsigned char *name)
{
/* Check POST_CHAR etc ... */
static const unsigned char chars[] = POST_CHAR_S "#?";
int i;
int namelen = strlen(name);
for (i = 0; i < sizeof(chars) - 1; i++) {
unsigned char *pos = memchr(name, chars[i], namelen);
if (!pos) continue;
return pos - name;
}
return namelen;
return strcspn(name, chars);
}
/* Encodes URIs without encoding stuff like fragments and query separators. */