drh / lcc

The lcc retargetable ANSI C compiler

Home Page:https://drh.github.io/lcc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[PATCH] The unsigned variable 'n' will never be negative so it is either pointless or an error to check if it is.

orbitcowboy opened this issue · comments

Please review the attached patch. The variable 'n' will never be negative so it is either pointless or an error to check if it is.

diff --git a/cpp/unix.c b/cpp/unix.c
index b3db364..400af35 100755
--- a/cpp/unix.c
+++ b/cpp/unix.c
@@ -97,7 +97,7 @@ memmove(void *dp, const void *sp, size_t n)
 {
        unsigned char *cdp, *csp;

-       if (n<=0)
+       if (n==0)
                return 0;
        cdp = dp;
        csp = (unsigned char *)sp;

Best regards and many thanks

Martin Ettl

Fixed. Thanks.