Re: diff between strnicmp() and strncasecmp()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 3 Oct 2007, Vegard Nossum wrote:

> On 10/2/07, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
> >   maybe i'm just missing something obvious, but is there any
> > difference between the above routines defined in lib/string.c?
> > they both appear to be length-limited, case-insensitive string
> > comparisons.
>
> I think they're the same, too, but both there for historical
> reasons. It seems strnicmp() was there from the beginning of time,
> and strncasecmp() came later. It is worth noting that strnicmp() is
> not described in POSIX or ANSI, however.

i noticed all of that.  i was going to suggest that, for the sake of
reducing redundancy, one or the other could be tossed but, after
looking again, it's probably not worth it.

almost everyone in kernel space seems to use strnicmp() as opposed to
strncasecmp():

  $ grep -rw strnicmp * | wc -l
  193
  $ grep -rw strncasecmp * | wc -l
  8

and even some of those calls to strncasecmp() are for user space or in
Documentation files.  it's a bit messy but probably not worth trying
to do anything about at this point.

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux