torrentd

simple torrent daemon
git clone git://git.2f30.org/torrentd
Log | Files | Refs | LICENSE

commit 4bc1926079ebfd91c56d5fb2df88d57ce84bb86e
parent fc3e8e817690a314b37ca5f9af4a7b8006a693ea
Author: sin <sin@2f30.org>
Date:   Thu, 17 Dec 2015 17:00:57 +0000

Simplify urlencode()

Diffstat:
Mutil.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/util.c b/util.c @@ -151,10 +151,9 @@ char * urlencode(char *s, size_t n) { char *p = s, *buf, *bp; - size_t i = 0; bp = buf = emalloc(n * 3 + 1); - while (i < n) { + while (p < &s[n]) { if (*p == '-' || *p == '_' || *p == '.' || *p == '~' || isalnum(*p)) { @@ -167,7 +166,6 @@ urlencode(char *s, size_t n) *bp++ = int2hex(*p); } p++; - i++; } *bp = '\0'; return buf;