]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Remove dead code in vis
authorGuillem Jover <guillem@hadrons.org>
Fri, 8 Jun 2018 22:08:14 +0000 (00:08 +0200)
committerGuillem Jover <guillem@hadrons.org>
Sun, 17 Jun 2018 21:01:02 +0000 (23:01 +0200)
The loop only executes while len > 0, and the trinary operator in the
function argument is checking against len >= 1 which will always be
true.

Warned-by: coverity
src/vis.c

index f17d322567448acc609efe91860707a36fe3c5bd..674d97141286ed68ed905aa1e21ca73aac7a4b52 100644 (file)
--- a/src/vis.c
+++ b/src/vis.c
@@ -503,7 +503,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
         */
        for (start = dst; len > 0; len--) {
                c = *src++;
-               dst = (*f)(dst, c, flags, len >= 1 ? *src : L'\0', extra);
+               dst = (*f)(dst, c, flags, *src, extra);
                if (dst == NULL) {
                        errno = ENOSPC;
                        goto out;