lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64f79f9610284091863ec8ce54660b85@AcuMS.aculab.com>
Date:   Wed, 5 Apr 2023 10:45:36 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Alexey Dobriyan' <adobriyan@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] string: implement streq()

From: Alexey Dobriyan
> Sent: 04 April 2023 15:55
> 
> On Mon, Apr 03, 2023 at 02:16:41PM -0700, Andrew Morton wrote:
> > On Sat, 1 Apr 2023 20:48:05 +0300 Alexey Dobriyan <adobriyan@...il.com> wrote:
> >
> > > Most of the time strcmp() is being used, strings are checked for equality.
> > > Add wrapper to relay such intent (it is shorter to type, too).
> > >
> > > Use
> > > 	if (streq(s, "s")) {
> > > 	}
> > > or
> > > 	if (!streq(s, "s")) {
> > > 	}
> >
> > Gee, do we really want this?  I mean, we all know how strcmp() works,
> > don't we?
> >
> > I'm thinking it would be better to remove the various cute little
> > streq() macros and open-code strcmp(...)==0.
> 
> No! It's cool, trust me. Try it out, you'll like it.
> We "know" how strcmp() works because C didn't have streq() from
> the very beginning.
> 
> strcmp() is only for insertion into trees. Half of the time you need
> to read to the end of the expression to know if it is check for equality
> or inequality. With streq(), you don't.

Instead you have to go away and look up what a function
you've never heard of does.

Live with strcmp()...

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ