diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2015-08-14 21:25:17 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2015-08-14 21:26:17 +0200 |
commit | c0fe2ae7064c4f927034aca87913bc28920721d9 (patch) | |
tree | ef11b9107c8334fde510eec92bfc0cc673e6c548 /gdb/d-exp.y | |
parent | a738da3abe2bc02d70521086cf1d0e23565b8fbe (diff) | |
download | gdb-c0fe2ae7064c4f927034aca87913bc28920721d9.zip gdb-c0fe2ae7064c4f927034aca87913bc28920721d9.tar.gz gdb-c0fe2ae7064c4f927034aca87913bc28920721d9.tar.bz2 |
Fix ARI warnings in d-exp.y
This fixes four ARI warnings found in d-exp.y.
This is comprised of three uses of the && or || at the end of a line, and one
use of sprintf.
gdb/ChangeLog
* d-exp.y (PrimaryExpression : TypeExp '.' IdentifierExp): Use
xstrprintf instead of malloc and sprintf.
(PrimaryExpression : IdentifierExp): Avoid operator at end of line.
(lex_one_token): Likewise.
Diffstat (limited to 'gdb/d-exp.y')
-rw-r--r-- | gdb/d-exp.y | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gdb/d-exp.y b/gdb/d-exp.y index bcf62ba..e23a0aa 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -475,8 +475,8 @@ PrimaryExpression: { if (symbol_read_needs_frame (sym.symbol)) { - if (innermost_block == 0 || - contained_in (sym.block, innermost_block)) + if (innermost_block == 0 + || contained_in (sym.block, innermost_block)) innermost_block = sym.block; } @@ -491,8 +491,8 @@ PrimaryExpression: { /* It hangs off of `this'. Must not inadvertently convert from a method call to data ref. */ - if (innermost_block == 0 || - contained_in (sym.block, innermost_block)) + if (innermost_block == 0 + || contained_in (sym.block, innermost_block)) innermost_block = sym.block; write_exp_elt_opcode (pstate, OP_THIS); write_exp_elt_opcode (pstate, OP_THIS); @@ -524,11 +524,12 @@ PrimaryExpression: struct block_symbol sym; const char *typename = TYPE_SAFE_NAME (type); int typename_len = strlen (typename); - char *name = malloc (typename_len + $3.length + 1); + char *name; - make_cleanup (free, name); - sprintf (name, "%.*s.%.*s", - typename_len, typename, $3.length, $3.ptr); + name = xstrprintf ("%.*s.%.*s", + typename_len, typename, + $3.length, $3.ptr); + make_cleanup (xfree, name); sym = lookup_symbol (name, (const struct block *) NULL, @@ -1207,8 +1208,8 @@ lex_one_token (struct parser_state *par_state) /* We will take any letters or digits, ignoring any embedded '_'. parse_number will complain if past the radix, or if L or U are not final. */ - else if ((*p < '0' || *p > '9') && (*p != '_') && - ((*p < 'a' || *p > 'z') && (*p < 'A' || *p > 'Z'))) + else if ((*p < '0' || *p > '9') && (*p != '_') + && ((*p < 'a' || *p > 'z') && (*p < 'A' || *p > 'Z'))) break; } |