aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-utils.h
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2013-11-11 09:19:32 +0400
committerJoel Brobecker <brobecker@adacore.com>2013-11-14 14:31:42 +0400
commitb5be8ce022f894831b133b3b424238d8058eb29e (patch)
tree4112aeb43628e418fecbb68a8cd46c5ae116f213 /gdb/cli/cli-utils.h
parent671afef641d8cf0672e36d7afeb053c8d01c294e (diff)
downloadgdb-b5be8ce022f894831b133b3b424238d8058eb29e.zip
gdb-b5be8ce022f894831b133b3b424238d8058eb29e.tar.gz
gdb-b5be8ce022f894831b133b3b424238d8058eb29e.tar.bz2
New function cli-utils.c:extract_arg_const
This function provides the exact same functionality as extract_arg, except that it takes a "const char**" instead of a "char **". It allows us also to re-implement extract_arg almost as a simple wrapper around the new function. gdb/ChangeLog: Pedro Alves <palves@redhat.com> Joel Brobecker <brobecker@adacore.com> * cli/cli-utils.h (extract_arg_const): Add declaration. * cli/cli-utils.c (extract_arg_const): New function. (extract_arg): Reimplement using extract_arg_const.
Diffstat (limited to 'gdb/cli/cli-utils.h')
-rw-r--r--gdb/cli/cli-utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h
index 152fb89..ebae2d2 100644
--- a/gdb/cli/cli-utils.h
+++ b/gdb/cli/cli-utils.h
@@ -118,6 +118,13 @@ extern char *remove_trailing_whitespace (const char *start, char *s);
extern char *extract_arg (char **arg);
+/* A const-correct version of "extract_arg".
+
+ Since the returned value is xmalloc'd, it eventually needs to be
+ xfree'ed, which prevents us from making it const as well. */
+
+extern char *extract_arg_const (const char **arg);
+
/* A helper function that looks for an argument at the start of a
string. The argument must also either be at the end of the string,
or be followed by whitespace. Returns 1 if it finds the argument,