svn commit: r196249 - in stable/7/lib/libc: . arm/string
Stanislav Sedov
stas at FreeBSD.org
Sat Aug 15 15:41:10 UTC 2009
Author: stas
Date: Sat Aug 15 15:41:10 2009
New Revision: 196249
URL: http://svn.freebsd.org/changeset/base/196249
Log:
- MFC r194583:
Fix strncmp on arm. Return 0 as result without performing the
main cycle only if the len passed is equal to 0. If end address
overflows use last possible address as the end address.
Modified:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/arm/string/strncmp.S
Modified: stable/7/lib/libc/arm/string/strncmp.S
==============================================================================
--- stable/7/lib/libc/arm/string/strncmp.S Sat Aug 15 15:40:30 2009 (r196248)
+++ stable/7/lib/libc/arm/string/strncmp.S Sat Aug 15 15:41:10 2009 (r196249)
@@ -33,13 +33,17 @@
__FBSDID("$FreeBSD$");
ENTRY(strncmp)
-/* if ((len - 1) < 0) return 0 */
- subs r2, r2, #1
- movmi r0, #0
- movmi pc, lr
+/* if (len == 0) return 0 */
+ cmp r2, #0
+ moveq r0, #0
+ moveq pc, lr
/* ip == last src address to compare */
- add ip, r0, r2
+ adds ip, r0, r2
+ sub ip, ip, #1
+/* Use last possible address on overflow. */
+ movcs ip, #0
+ subcs ip, ip, #1
1:
ldrb r2, [r0], #1
ldrb r3, [r1], #1
More information about the svn-src-stable
mailing list