From 3791d282ca91f9961da6c87077b23c4f054f00de Mon Sep 17 00:00:00 2001 From: rillig Date: Fri, 27 Aug 2021 17:38:57 +0000 Subject: [PATCH] sdiff: fix undefined behavior for ctype functions lint says: warning: argument to 'function from ' must be cast to 'unsigned char', not to 'int' [342] --- usr.bin/sdiff/sdiff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c index cf8260fac749..c97e72a3b0ba 100644 --- a/usr.bin/sdiff/sdiff.c +++ b/usr.bin/sdiff/sdiff.c @@ -1,4 +1,4 @@ -/* $NetBSD: sdiff.c,v 1.2 2009/04/13 07:19:55 lukem Exp $ */ +/* $NetBSD: sdiff.c,v 1.3 2021/08/27 17:38:57 rillig Exp $ */ /* $OpenBSD: sdiff.c,v 1.20 2006/09/19 05:52:23 otto Exp $ */ /* @@ -423,7 +423,7 @@ prompt(const char *s1, const char *s2) const char *p; /* Skip leading whitespace. */ - for (p = cmd; isspace((int)(*p)); ++p) + for (p = cmd; isspace((unsigned char)(*p)); ++p) ; switch (*p) { @@ -579,7 +579,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FILE *file2) p = line; /* Go to character after line number. */ - while (isdigit((int)(*p))) + while (isdigit((unsigned char)(*p))) ++p; c = *p; *p++ = 0; @@ -592,7 +592,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FILE *file2) q = p; /* Go to character after file2end. */ - while (isdigit((int)(*p))) + while (isdigit((unsigned char)(*p))) ++p; c = *p; *p++ = 0; @@ -612,7 +612,7 @@ parsecmd(FILE *diffpipe, FILE *file1, FILE *file2) q = p; /* Go to character after line number. */ - while (isdigit((int)(*p))) + while (isdigit((unsigned char)(*p))) ++p; c = *p; *p++ = 0;