From patchwork Wed Oct 19 01:11:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 16631 Received: (qmail 122787 invoked by alias); 19 Oct 2016 01:12:25 -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 122753 invoked by uid 89); 19 Oct 2016 01:12:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=sk:print_c, Hx-languages-length:2006, 4596 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Oct 2016 01:12:23 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F4B04E4F3 for ; Wed, 19 Oct 2016 01:12:22 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9J1CJjX019701 for ; Tue, 18 Oct 2016 21:12:21 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 02/31] cli/cli-script.c: Remove some dead NULL checks Date: Wed, 19 Oct 2016 02:11:50 +0100 Message-Id: <1476839539-8374-3-git-send-email-palves@redhat.com> In-Reply-To: <1476839539-8374-1-git-send-email-palves@redhat.com> References: <1476839539-8374-1-git-send-email-palves@redhat.com> gdb/ChangeLog: yyyy-mm-dd Pedro Alves * cli/cli-script.c (execute_control_command): Assume insert_args never returns NULL. (insert_args): Assume xmalloc never returns NULL. --- gdb/cli/cli-script.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 579d0a4..c36cce6 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -459,8 +459,6 @@ execute_control_command (struct command_line *cmd) case simple_control: /* A simple command, execute it and return. */ new_line = insert_args (cmd->line); - if (!new_line) - break; make_cleanup (free_current_contents, &new_line); execute_command (new_line, 0); ret = cmd->control_type; @@ -492,8 +490,6 @@ execute_control_command (struct command_line *cmd) /* Parse the loop control expression for the while statement. */ new_line = insert_args (cmd->line); - if (!new_line) - break; make_cleanup (free_current_contents, &new_line); expr = parse_expression (new_line); make_cleanup (free_current_contents, &expr); @@ -560,8 +556,6 @@ execute_control_command (struct command_line *cmd) print_command_trace (buffer); new_line = insert_args (cmd->line); - if (!new_line) - break; make_cleanup (free_current_contents, &new_line); /* Parse the conditional for the if statement. */ expr = parse_expression (new_line); @@ -605,8 +599,6 @@ execute_control_command (struct command_line *cmd) /* Breakpoint commands list, record the commands in the breakpoint's command list and return. */ new_line = insert_args (cmd->line); - if (!new_line) - break; make_cleanup (free_current_contents, &new_line); ret = commands_from_control_command (new_line, cmd); break; @@ -853,8 +845,6 @@ insert_args (char *line) /* Allocate space for the new line and fill it in. */ new_line = (char *) xmalloc (len + 1); - if (new_line == NULL) - return NULL; /* Restore pointer to beginning of old line. */ line = save_line;