Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2009 00:08:46 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        channa.kad@gmail.com
Cc:        freebsd-arm@freebsd.org
Subject:   Re: strncmp issue
Message-ID:  <20090430.000846.1484329326.imp@bsdimp.com>
In-Reply-To: <515c64960904292221v1e927ef2vb3ed2940f76d32cf@mail.gmail.com>
References:  <515c64960904282316k5f3e80cdu1c04a8dc3ab25883@mail.gmail.com> <20090429221236.GA28784@ci0.org> <515c64960904292221v1e927ef2vb3ed2940f76d32cf@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <515c64960904292221v1e927ef2vb3ed2940f76d32cf@mail.gmail.co=
m>
            Channa <channa.kad@gmail.com> writes:
: 2009/4/30 Olivier Houchard <mlfbsd@ci0.org>:
: > On Wed, Apr 29, 2009 at 11:46:23AM +0530, Channa wrote:
: >> 2009/4/29 Olivier Houchard <mlfbsd@ci0.org>:
: >> > On Tue, Apr 28, 2009 at 07:32:14PM +0530, Channa wrote:
: >> >> Hi,
: >> >>
: >> >> Thank you very much for your response.
: >> >> I am looking forward for your fix.
: >> >>
: >> >> Thanks & Regards,
: >> >> Channa
: >> >>
: >> >
: >> > Hi,
: >> >
: >> > I just committed a fix to -CURRENT, as rev 191633.
: >> > It basically just checks if the length is 0, instead of len - 1 =
< 0.
: >> >
: >> > Thanks again,
: >> >
: >> > Olivier
: >> >
: >> >
: >> >
: >>
: >> Hi
: >> Thank you very much. I used your fix and tested again.
: >> When i tested as below :
: >>
: >> TEST 1 :
: >> =A0 ret =3D strncmp("a", "L", -1); =A0<----------------- ret is '0=
'
: >>
: >
: > I'm a bit confused here, when I test this I get 21, which is the in=
tended
: > result. Are you sure you weren't still using the old strncmp() ?
: =

: Hi,
: Yes i am using the latest version of strncmp.S in the CURRENT branch.=

: Sorry there was a typo i tested strncmp as
: =

: ret =3D strncmp("a","b",-1)  <------ ret value is still '0'
: =

: I am still getting the return value as zero, it should be -1.

Yes.  We should get the following results:

      strncmp("a", "b", 0);	  0
      strncmp("a", "b", *);	  < 0

where * is any other number :)

Warner




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090430.000846.1484329326.imp>