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

cookies: Use strrchr instead of ad-hoc loop.

The size and speed of the object code probably don't change much,
but the source becomes easier to read.
This commit is contained in:
Kalle Olavi Niemitalo 2006-05-30 09:45:10 +03:00 committed by Miciah Dashiel Butler Masters
parent 3e32131469
commit e8233fa06a

View File

@ -400,13 +400,9 @@ set_cookie(struct uri *uri, unsigned char *str)
return;
}
for (path_end = path + strlen(path) - 1;
path_end >= path; path_end--) {
if (*path_end == '/') {
path_end[1] = '\0';
break;
}
}
path_end = strrchr(path, '/');
if (path_end)
path_end[1] = '\0';
break;
default: /* error */