From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18473 invoked by alias); 14 Mar 2013 18:09:43 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 18443 invoked by uid 306); 14 Mar 2013 18:09:41 -0000 Date: Thu, 14 Mar 2013 18:09:00 -0000 Message-ID: <20130314180941.18428.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/constify: base extract_arg on extract_arg_const X-Git-Refname: refs/heads/tromey/constify X-Git-Reftype: branch X-Git-Oldrev: d322fc78389df20e123558cc395ccba57a668a82 X-Git-Newrev: 19e1c31f7f11f55caec33fb92c1d4e37decf303f X-SW-Source: 2013-q1/txt/msg00258.txt.bz2 List-Id: 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 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.