sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 6e78f638982333262944bc45be25a89e550dfd3c
parent 704564418139fdaa3b98b164faa1f40394dbb352
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 27 May 2020 20:33:39 +0200

util: encodeuri: simplify condition

iscntrl is c < ' ' || c == 127
I want to encode a space and everything above 127 also.

So this condition can be simplified to this.

Diffstat:
Mutil.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/util.c b/util.c @@ -93,9 +93,8 @@ encodeuri(char *buf, size_t bufsiz, const char *s) size_t i, b; for (i = 0, b = 0; s[i]; i++) { - if (s[i] == ' ' || - (unsigned char)s[i] > 127 || - iscntrl((unsigned char)s[i])) { + if ((unsigned char)s[i] <= ' ' || + (unsigned char)s[i] >= 127) { if (b + 3 >= bufsiz) return -1; buf[b++] = '%';