aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
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/ada-exp.y
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/ada-exp.y')
-rw-r--r--gdb/ada-exp.y15
1 files changed, 9 insertions, 6 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 877dfaf..5270461 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -136,7 +136,7 @@ static void write_name_assoc (struct stoken);
static void write_exp_op_with_string (enum exp_opcode, struct stoken);
-static struct block *block_lookup (struct block *, char *);
+static struct block *block_lookup (struct block *, const char *);
static LONGEST convert_char_literal (struct type *, LONGEST);
@@ -952,6 +952,8 @@ write_object_renaming (const struct block *orig_left_context,
{
struct stoken field_name;
const char *end;
+ char *buf;
+
renaming_expr += 1;
if (slice_state != SIMPLE_INDEX)
@@ -960,9 +962,10 @@ write_object_renaming (const struct block *orig_left_context,
if (end == NULL)
end = renaming_expr + strlen (renaming_expr);
field_name.length = end - renaming_expr;
- field_name.ptr = malloc (end - renaming_expr + 1);
- strncpy (field_name.ptr, renaming_expr, end - renaming_expr);
- field_name.ptr[end - renaming_expr] = '\000';
+ buf = malloc (end - renaming_expr + 1);
+ field_name.ptr = buf;
+ strncpy (buf, renaming_expr, end - renaming_expr);
+ buf[end - renaming_expr] = '\000';
renaming_expr = end;
write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
break;
@@ -980,9 +983,9 @@ write_object_renaming (const struct block *orig_left_context,
}
static struct block*
-block_lookup (struct block *context, char *raw_name)
+block_lookup (struct block *context, const char *raw_name)
{
- char *name;
+ const char *name;
struct ada_symbol_info *syms;
int nsyms;
struct symtab *symtab;