public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  tromey/constify: base extract_arg on extract_arg_const
@ 2013-03-14 18:09 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2013-03-14 18:09 UTC (permalink / raw)
  To: archer-commits

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-14 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-14 18:09 [SCM] tromey/constify: base extract_arg on extract_arg_const tromey

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).