aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2013-10-02 00:46:07 +0000
committerKeith Seitz <keiths@redhat.com>2013-10-02 00:46:07 +0000
commitd7561cbbf27a8ff771f85baf6696aa7645250484 (patch)
treeeb81d452fe456e9a043cc453bf8b65617b40e915 /gdb/parse.c
parent62574b938f80a485874b85a770d03bf0f21eece5 (diff)
downloadgdb-d7561cbbf27a8ff771f85baf6696aa7645250484.zip
gdb-d7561cbbf27a8ff771f85baf6696aa7645250484.tar.gz
gdb-d7561cbbf27a8ff771f85baf6696aa7645250484.tar.bz2
Constification of parse_linespec and fallout:
https://sourceware.org/ml/gdb-patches/2013-09/msg01017.html https://sourceware.org/ml/gdb-patches/2013-09/msg01018.html https://sourceware.org/ml/gdb-patches/2013-09/msg01019.html https://sourceware.org/ml/gdb-patches/2013-09/msg01020.html
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 674342b..07c1765 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -75,8 +75,8 @@ CORE_ADDR expression_context_pc;
const struct block *innermost_block;
int arglist_len;
static struct type_stack type_stack;
-char *lexptr;
-char *prev_lexptr;
+const char *lexptr;
+const char *prev_lexptr;
int paren_depth;
int comma_terminates;
@@ -123,7 +123,7 @@ static int prefixify_subexp (struct expression *, struct expression *, int,
static struct expression *parse_exp_in_context (const char **, CORE_ADDR,
const struct block *, int,
int, int *);
-static struct expression *parse_exp_in_context_1 (char **, CORE_ADDR,
+static struct expression *parse_exp_in_context_1 (const char **, CORE_ADDR,
const struct block *, int,
int, int *);
@@ -733,8 +733,8 @@ handle_register:
}
-char *
-find_template_name_end (char *p)
+const char *
+find_template_name_end (const char *p)
{
int depth = 1;
int just_seen_right = 0;
@@ -1142,16 +1142,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
const struct block *block,
int comma, int void_context_p, int *out_subexp)
{
- struct expression *expr;
- char *const_hack = *stringptr ? xstrdup (*stringptr) : NULL;
- char *orig = const_hack;
- struct cleanup *back_to = make_cleanup (xfree, const_hack);
-
- expr = parse_exp_in_context_1 (&const_hack, pc, block, comma,
+ return parse_exp_in_context_1 (stringptr, pc, block, comma,
void_context_p, out_subexp);
- (*stringptr) += const_hack - orig;
- do_cleanups (back_to);
- return expr;
}
/* As for parse_exp_1, except that if VOID_CONTEXT_P, then
@@ -1162,7 +1154,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
is left untouched. */
static struct expression *
-parse_exp_in_context_1 (char **stringptr, CORE_ADDR pc,
+parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
const struct block *block,
int comma, int void_context_p, int *out_subexp)
{