Date: Tue, 28 Apr 2009 15:22:41 +0530 From: Channa <channa.kad@gmail.com> To: freebsd-current@freebsd.org Subject: strncmp issue Message-ID: <515c64960904280252sc9fe2afy24e8db8ab13b13e4@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi,
I am using the freebsd implementation of strncmp for ARM which is an
assembly implementation.
I have a small doubt, when i tested the strncmp by passing the third argument:
'n' as -1 the return values is '0' instead it should '-1'.
When the third argument to strncmp is as below:
ret = strncmp("a","b",-1)
I think the assembly implementation in
src/lib/libc/arm/string/strncmp.S file needs
to be modified to take care of the above condition.
In the current implementation
/* if ((len - 1) < 0) return 0 */
subs r2, r2, #1
movmi r0, #0
RETc(mi)
This should be changed to check as below
/* if ((len ) < 0) return 0 */
/* Assembly code here */
Could anyone help in solving the above issue.?
Thanks & Regards,
Channagoud
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?515c64960904280252sc9fe2afy24e8db8ab13b13e4>
