This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] New common function "startswith"

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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]