patch-2.4.22 linux-2.4.22/arch/ppc/lib/string.S
Next file: linux-2.4.22/arch/ppc/math-emu/fcmpo.c
Previous file: linux-2.4.22/arch/ppc/lib/locks.c
Back to the patch index
Back to the overall index
- Lines: 31
- Date:
2003-08-25 04:44:40.000000000 -0700
- Orig file:
linux-2.4.21/arch/ppc/lib/string.S
- Orig date:
2003-06-13 07:51:31.000000000 -0700
diff -urN linux-2.4.21/arch/ppc/lib/string.S linux-2.4.22/arch/ppc/lib/string.S
@@ -77,6 +77,8 @@
bne 1b
blr
+/* This clears out any unused part of the destination buffer,
+ just as the libc version does. -- paulus */
.globl strncpy
strncpy:
cmpwi 0,r5,0
@@ -88,6 +90,12 @@
cmpwi 0,r0,0
stbu r0,1(r6)
bdnzf 2,1b /* dec ctr, branch if ctr != 0 && !cr0.eq */
+ bnelr /* if we didn't hit a null char, we're done */
+ mfctr r5
+ cmpwi 0,r5,0 /* any space left in destination buffer? */
+ beqlr /* we know r0 == 0 here */
+2: stbu r0,1(r6) /* clear it out if so */
+ bdnz 2b
blr
.globl strcat
@@ -380,7 +388,7 @@
beq 2b
mtctr r7
b 1b
-
+
.globl memcmp
memcmp:
cmpwi 0,r5,0
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)