From patchwork Fri Aug 14 19:21:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 8214 Received: (qmail 112507 invoked by alias); 14 Aug 2015 19:21:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 112489 invoked by uid 89); 14 Aug 2015 19:21:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 14 Aug 2015 19:21:33 +0000 Received: by wicne3 with SMTP id ne3so28946144wic.1 for ; Fri, 14 Aug 2015 12:21:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.79.132 with SMTP id j4mr9266603wix.87.1439580090861; Fri, 14 Aug 2015 12:21:30 -0700 (PDT) Received: by 10.27.16.2 with HTTP; Fri, 14 Aug 2015 12:21:30 -0700 (PDT) Date: Fri, 14 Aug 2015 21:21:30 +0200 Message-ID: Subject: [PATCH/commit] Fix ARI warnings in d-exp.y From: Iain Buclaw To: GDB Patches X-IsSubscribed: yes This patch fixes four ARI warnings for d-exp.y. I will make the assumption that it is fine to push small this in as obvious. Regards Iain --- 2015-08-14 Iain Buclaw * 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. 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; }