Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Andreas Arnez <arnez@linux.vnet.ibm.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] New common function "startswith"
Date: Wed, 04 Mar 2015 09:27:00 -0000	[thread overview]
Message-ID: <20150304092720.GA26337@blade.nx> (raw)
In-Reply-To: <87y4nevsjg.fsf@br87z6lw.de.ibm.com>

Andreas Arnez wrote:
> On Tue, Mar 03 2015, Gary Benson wrote:
> > Joel Brobecker wrote:
> > > Also, how about we rename the parameters to something like "str"
> > > instead of "s1" and "pattern" for s2. It makes it faster, IMO,
> > > to figure out the parameter order without having to read the
> > > function's documentation, and therefore makes it's use a little
> > > less error-prone.
> >
> > I can do that.  I also found some more, with the pattern strncmp
> > (string, "something", sizeof ("something") -1) so I'll update the
> > patch to include those too.
> 
> Considering the lot of occurrences, IMHO the function should better
> be defined as inline.  Then, if the compiler can inline strncmp, the
> function calls will be eliminated completely.  Also, this would
> leave the string comparison visible to the compiler for
> array-out-of-bound checks.

For some reason I thought GDB didn't allow inline functions, but I
see there are quite a few so, yeah, I'll do that.  Aside from
anything else it will allow the strlen calls to be eliminated for
string constants.

Cheers,
Gary

-- 
http://gbenson.net/


  reply	other threads:[~2015-03-04  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 13:10 Gary Benson
2015-03-03 15:49 ` Andreas Arnez
2015-03-03 16:06 ` Joel Brobecker
2015-03-03 17:16   ` Gary Benson
2015-03-03 18:34     ` Andreas Arnez
2015-03-04  9:27       ` Gary Benson [this message]
2015-03-04 16:27         ` [PATCH v2] " Gary Benson
2015-03-05 18:18           ` Joel Brobecker
2015-03-06  9:48             ` Gary Benson
2015-03-04  8:45 ` [PATCH] " Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150304092720.GA26337@blade.nx \
    --to=gbenson@redhat.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox