Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/string use postincrement, like the patch



details:   https://anonhg.NetBSD.org/src/rev/717b0dbd43bd
branches:  trunk
changeset: 836406:717b0dbd43bd
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 15 19:32:48 2018 +0000

description:
use postincrement, like the patch
XXX: pullup-8

diffstat:

 common/lib/libc/string/memmem.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 0f8634e0655f -r 717b0dbd43bd common/lib/libc/string/memmem.c
--- a/common/lib/libc/string/memmem.c   Mon Oct 15 18:58:35 2018 +0000
+++ b/common/lib/libc/string/memmem.c   Mon Oct 15 19:32:48 2018 +0000
@@ -25,7 +25,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/lib/libc/string/memmem.c 315468 2017-03-18 00:53:24Z emaste $");
 #else
-__RCSID("$NetBSD: memmem.c,v 1.2 2018/10/15 18:37:19 christos Exp $");
+__RCSID("$NetBSD: memmem.c,v 1.3 2018/10/15 19:32:48 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -40,7 +40,7 @@
     const unsigned char *n)
 {
        uint16_t nw = n[0] << 8 | n[1], hw = h[0] << 8 | h[1];
-       for (h += 2, k -= 2; k; k--, hw = hw << 8 | *++h)
+       for (h += 2, k -= 2; k; k--, hw = hw << 8 | *h++)
                if (hw == nw) return __UNCONST(h - 2);
        return hw == nw ? __UNCONST(h - 2) : 0;
 }
@@ -50,7 +50,7 @@
 {
        uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8;
        uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8;
-       for (h += 3, k -= 3; k; k--, hw = (hw|*++h) << 8)
+       for (h += 3, k -= 3; k; k--, hw = (hw|*h++) << 8)
                if (hw == nw) return __UNCONST(h - 3);
        return hw == nw ? __UNCONST(h - 3) : 0;
 }
@@ -60,7 +60,7 @@
 {
        uint32_t nw = n[0] << 24 | n[1] << 16 | n[2] << 8 | n[3];
        uint32_t hw = h[0] << 24 | h[1] << 16 | h[2] << 8 | h[3];
-       for (h += 4, k -= 4; k; k--, hw = hw << 8 | *++h)
+       for (h += 4, k -= 4; k; k--, hw = hw << 8 | *h++)
                if (hw == nw) return __UNCONST(h - 4);
        return hw == nw ? __UNCONST(h - 4) : 0;
        return 0;



Home | Main Index | Thread Index | Old Index