Re: strncmp issue

From: Gavin Atkinson <gavin_at_FreeBSD.org>
Date: Tue, 28 Apr 2009 12:31:02 +0100
This probably belongs on the -arm list, which I'm CCing.

On Tue, 2009-04-28 at 15:22 +0530, Channa wrote:
> 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
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Tue Apr 28 2009 - 09:31:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:46 UTC