[PATCH] Add startswith function and use it instead of CONST_STRNEQ.

Hans-Peter Nilsson hp@bitrange.com
Fri Mar 19 17:55:34 GMT 2021


On Fri, 19 Mar 2021, Martin Li?ka wrote:
> On 3/19/21 7:37 AM, Alan Modra wrote:
> > On Thu, Mar 18, 2021 at 02:29:26PM -0400, Hans-Peter Nilsson wrote:
> > > How about instead moving and/or making more use of CONST_STRNEQ
> > > from bfd/bfd-in.h?
> >
> > To me the name CONST_STRNEQ just doesn't parse well.  Maybe I'm just
> > weird, but I read it as "constant string not equal"

It's not that? :-)

> > which of course is
> > wrong.  I much prefer startswith as a name.
>
> No, you're not weird! The function name is weird. To be honest, I noticed
> the function, but the name was so misleading that I ignored it.
>
> > bfd-in.h ought to work
> > for an inline startswith too, since every sysdep.h in binutils already
> > includes string.h, and so too does gas/as.h.
>
> Yes, that's a correct location. I tried placing the new function here, but
> I didn't notice 'make headers' :)
>
> Anyway, as a first step I'm suggesting to do the renaming and I can carry on
> with follow up patches that will use the function more.

FWIW, I don't mind; I'm not even the author, as obvious from my
comment.  I just had this hunch that "didn't <name withheld> do
something like this some time ago?  Now where *is* that
whatsitsname macro?"

(Maybe CONST_STREQN?  Nah...  I'm out.)

brgds, H-P


More information about the Binutils mailing list