public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  tromey/constify: base extract_arg on extract_arg_const
Date: Thu, 14 Mar 2013 18:09:00 -0000	[thread overview]
Message-ID: <20130314180941.18428.qmail@sourceware.org> (raw)

The branch, tromey/constify has been updated
       via  19e1c31f7f11f55caec33fb92c1d4e37decf303f (commit)
      from  d322fc78389df20e123558cc395ccba57a668a82 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 19e1c31f7f11f55caec33fb92c1d4e37decf303f
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Mar 14 12:09:08 2013 -0600

    base extract_arg on extract_arg_const

-----------------------------------------------------------------------

Summary of changes:
 gdb/cli/cli-utils.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

First 500 lines of diff:
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 52ca536..777d7a4 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -261,41 +261,37 @@ remove_trailing_whitespace (const char *start, char *s)
 /* See documentation in cli-utils.h.  */
 
 char *
-extract_arg (char **arg)
+extract_arg_const (const char **arg)
 {
-  char *result, *copy;
+  const char *result;
 
   if (!*arg)
     return NULL;
 
   /* Find the start of the argument.  */
-  *arg = skip_spaces (*arg);
+  *arg = skip_spaces_const (*arg);
   if (!**arg)
     return NULL;
   result = *arg;
 
   /* Find the end of the argument.  */
-  *arg = skip_to_space (*arg + 1);
+  *arg = skip_to_space_const (*arg + 1);
 
   if (result == *arg)
     return NULL;
 
-  copy = xmalloc (*arg - result + 1);
-  memcpy (copy, result, *arg - result);
-  copy[*arg - result] = '\0';
-
-  return copy;
+  return savestring (result, *arg - result);
 }
 
 /* See documentation in cli-utils.h.  */
 
 char *
-extract_arg_const (const char **arg)
+extract_arg (char **arg)
 {
-  char *tem = (char *) *arg;
-  char *result = extract_arg (&tem);
+  const char *tem = *arg;
+  char *result = extract_arg_const (&tem);
 
-  *arg = tem;
+  *arg = (char *) tem;
   return result;
 }
 


hooks/post-receive
--
Repository for Project Archer.


                 reply	other threads:[~2013-03-14 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130314180941.18428.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).