summaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2013-10-02 00:46:06 +0000
committerKeith Seitz <keiths@redhat.com>2013-10-02 00:46:06 +0000
commitc85cddc51d5d9e4423509a2dc7cf3d9809451b49 (patch)
treef4d948ed91161a563c7dd24c56197f183a50a24a /gdb/parse.c
parent9cb8e9ab9d225807a721e2b6d520e663fc2fbb81 (diff)
downloadgdb-c85cddc51d5d9e4423509a2dc7cf3d9809451b49.tar.gz
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 674342bd3aa..07c17651bbb 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)
{