diff options
author | Keith Seitz <keiths@redhat.com> | 2013-10-02 00:46:07 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2013-10-02 00:46:07 +0000 |
commit | d7561cbbf27a8ff771f85baf6696aa7645250484 (patch) | |
tree | eb81d452fe456e9a043cc453bf8b65617b40e915 /gdb/jv-exp.y | |
parent | 62574b938f80a485874b85a770d03bf0f21eece5 (diff) | |
download | gdb-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/jv-exp.y')
-rw-r--r-- | gdb/jv-exp.y | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index a4e1253..2c5154e 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -47,6 +47,7 @@ #include "symfile.h" /* Required by objfiles.h. */ #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ #include "block.h" +#include "completer.h" #define parse_type builtin_type (parse_gdbarch) #define parse_java_type builtin_java_type (parse_gdbarch) @@ -154,7 +155,7 @@ static void insert_exp (int, struct expression *); %{ /* YYSTYPE gets defined by %union */ -static int parse_number (char *, int, int, YYSTYPE *); +static int parse_number (const char *, int, int, YYSTYPE *); %} %type <lval> rcurly Dims Dims_opt @@ -345,10 +346,13 @@ QualifiedName: $$.ptr = $1.ptr; /* Optimization. */ else { - $$.ptr = (char *) malloc ($$.length + 1); - make_cleanup (free, $$.ptr); - sprintf ($$.ptr, "%.*s.%.*s", + char *buf; + + buf = malloc ($$.length + 1); + make_cleanup (free, buf); + sprintf (buf, "%.*s.%.*s", $1.length, $1.ptr, $3.length, $3.ptr); + $$.ptr = buf; } } ; @@ -696,7 +700,7 @@ Expression: /*** Needs some error checking for the float case ***/ static int -parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere) +parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere) { ULONGEST n = 0; ULONGEST limit, limit_div_base; @@ -858,8 +862,8 @@ yylex (void) int c; int namelen; unsigned int i; - char *tokstart; - char *tokptr; + const char *tokstart; + const char *tokptr; int tempbufindex; static char *tempbuf; static int tempbufsize; @@ -966,7 +970,7 @@ yylex (void) { /* It's a number. */ int got_dot = 0, got_e = 0, toktype; - char *p = tokstart; + const char *p = tokstart; int hex = input_radix > 10; if (c == '0' && (p[1] == 'x' || p[1] == 'X')) |