From: Yao Qi <yao@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] constify search_symbols
Date: Tue, 24 Jun 2014 03:11:00 -0000 [thread overview]
Message-ID: <53A8EC05.2030901@codesourcery.com> (raw)
In-Reply-To: <1403285060-5556-1-git-send-email-tromey@redhat.com>
On 06/21/2014 01:24 AM, Tom Tromey wrote:
> - char **files = NULL, *file_name;
> + const char **files = NULL;
> + const char *file_name;
> int nfiles = 0;
>
> if (regexp)
> @@ -3960,13 +3961,15 @@ rbreak_command (char *regexp, int from_tty)
> if (colon && *(colon + 1) != ':')
> {
> int colon_index;
> + char *local_name;
>
> colon_index = colon - regexp;
> - file_name = alloca (colon_index + 1);
> - memcpy (file_name, regexp, colon_index);
> - file_name[colon_index--] = 0;
> - while (isspace (file_name[colon_index]))
> - file_name[colon_index--] = 0;
> + local_name = alloca (colon_index + 1);
> + memcpy (local_name, regexp, colon_index);
> + local_name[colon_index--] = 0;
> + while (isspace (local_name[colon_index]))
> + local_name[colon_index--] = 0;
> + file_name = local_name;
file_name isn't used out side of this block, so we can define file_name
within this block of type "char *", and patch can be shorter.
--
Yao (é½å°§)
next prev parent reply other threads:[~2014-06-24 3:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 17:24 Tom Tromey
2014-06-24 3:11 ` Yao Qi [this message]
2014-06-24 13:18 ` Tom Tromey
2014-06-24 13:44 ` Yao Qi
2014-06-30 14:31 ` Tom Tromey
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=53A8EC05.2030901@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).