Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Peter Bergner <bergner@vnet.ibm.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,
	gdb-patches@sourceware.org, Alan Modra <amodra@gmail.com>,
	Ulrich Weigand <uweigand@de.ibm.com>,
	Eli Zaretskii <eliz@gnu.org>, Nick Clifton <nickc@redhat.com>,
	binutils <binutils@sourceware.org>
Subject: Re: [PATCH, updated] Add support for setting disassembler-options in GDB for POWER, ARM and S390
Date: Thu, 16 Feb 2017 02:09:00 -0000	[thread overview]
Message-ID: <265f32d1-d913-068c-6716-37b3e55da849@redhat.com> (raw)
In-Reply-To: <7458110b-366a-ee02-9668-3ebef0dfd8cf@vnet.ibm.com>

On 02/16/2017 01:58 AM, Peter Bergner wrote:
> On 2/15/17 6:21 PM, Pedro Alves wrote:

>>> Easily done, as I've been doing just that internally.
>>> I'm frightened to say that I'm at v25 and counting. :-(
>>
>> Internal revisions don't count, only public submissions.  :-)
> 
> Well the number of public submissions isn't too far off my
> internal patches. :-)

:-)

>>>   Eg: "e500" & "e500mc", "ppc" & "ppc32" and "ppc64", etc.
>>>
>>> ...which strncmp cannot disambiguate, because it doesn't enforce the
>>> two strings have the same length.
>>
>> You could handle that with:
>>
>> if (optlen == strlen (valid_options->name[i])
>>     && strncmp (opt, optlen, valid_options->name[i]) == 0)
> 
> Yes, but that involves two scans over the string, so...

This is far from performance critical code, but if you're
worried about the double-scan, then you could write it like this:

 if (strncmp (opt, valid_options->name[i], optlen) == 0
     && valid_options->name[optlen] == '\0')

Thanks,
Pedro Alves


  reply	other threads:[~2017-02-16  2:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 21:03 Peter Bergner
2017-02-13 15:53 ` Yao Qi
2017-02-13 16:31   ` Peter Bergner
2017-02-13 16:58   ` Pedro Alves
2017-02-13 17:32     ` Peter Bergner
2017-02-14 17:21     ` Yao Qi
2017-02-14 17:35       ` Pedro Alves
2017-02-13 17:08   ` Peter Bergner
2017-02-13 18:48   ` Peter Bergner
2017-02-14 20:01     ` Pedro Alves
2017-02-15 23:14       ` Peter Bergner
2017-02-15 23:48         ` Alan Modra
2017-02-16  0:21         ` Pedro Alves
2017-02-16  1:59           ` Peter Bergner
2017-02-16  2:09             ` Pedro Alves [this message]
2017-02-13 18:52 ` Peter Bergner

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=265f32d1-d913-068c-6716-37b3e55da849@redhat.com \
    --to=palves@redhat.com \
    --cc=amodra@gmail.com \
    --cc=bergner@vnet.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=qiyaoltc@gmail.com \
    --cc=uweigand@de.ibm.com \
    /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