From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UbTuW-0000KJ-HW for mharc-grub-devel@gnu.org; Sun, 12 May 2013 06:53:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbTuS-0000KC-DJ for grub-devel@gnu.org; Sun, 12 May 2013 06:53:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbTuO-00047E-KC for grub-devel@gnu.org; Sun, 12 May 2013 06:53:44 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:35928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbTuO-000475-EJ for grub-devel@gnu.org; Sun, 12 May 2013 06:53:40 -0400 Received: by mail-we0-f172.google.com with SMTP id w60so5433023wes.3 for ; Sun, 12 May 2013 03:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=IGXg8431gSrxYIBqWbw2TrNazA4f5iqY4K4EUynXiNs=; b=kPaVAjLsmK2OGFiGi0ExHrXnGKA6zSofcFkYxFwRC0PRCpPKUDhWOkLLuD9gn09TzE 8CSF9uGOo79d5ZeKL3P6N4TVDvQQxVjWVepSD4fR+JnmyoA31dV8ihIrdvzhYHwbr3Ly DKnq875ZzAT2QJutKEDpeJ9cDyrbKWvK2Pri2ObNFr14ocwNH0ssvkcKMdjlplfL1wcY vJJSbw4tOHTh3LU7ykIqRezj8gRUEjz/DEcrA2XL7WVr/rq6UkpMgYCUrgDwqphjBvWW r8oIx/3qwIaqUNkKtOiPXB3uDlJe6Gnwhh8f8wPiqtFBdOxnwq5gLDCWBsh2e1zn66S1 3jPg== X-Received: by 10.180.189.41 with SMTP id gf9mr12591770wic.32.1368356019682; Sun, 12 May 2013 03:53:39 -0700 (PDT) Received: from [192.168.56.2] (ppp-173-23.31-151.libero.it. [151.31.23.173]) by mx.google.com with ESMTPSA id ed20sm9486255wic.0.2013.05.12.03.53.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 12 May 2013 03:53:39 -0700 (PDT) Message-ID: <518F74FC.40104@gmail.com> Date: Sun, 12 May 2013 12:54:52 +0200 From: Francesco Lavra User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: [PATCH 1/2] ls core command: remove unreachable code References: <518F74AA.6090907@gmail.com> In-Reply-To: <518F74AA.6090907@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2013 10:53:47 -0000 The path local variable in grub_core_cmd_ls() is assigned values such that it cannot be NULL, so a couple of if blocks can be removed as they are never executed. 2013-05-12 Francesco Lavra * grub-core/kern/corecmd.c (grub_core_cmd_ls): Remove unreachable code. === modified file 'grub-core/kern/corecmd.c' --- grub-core/kern/corecmd.c 2013-03-03 00:34:27 +0000 +++ grub-core/kern/corecmd.c 2013-05-12 09:36:16 +0000 @@ -139,21 +139,7 @@ else path++; - if (! path && ! device_name) - { - grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); - goto fail; - } - - if (! path) - { - if (grub_errno == GRUB_ERR_UNKNOWN_FS) - grub_errno = GRUB_ERR_NONE; - - grub_printf ("(%s): Filesystem is %s.\n", - device_name, fs ? fs->name : "unknown"); - } - else if (fs) + if (fs) { (fs->dir) (dev, path, grub_mini_print_files, NULL); grub_xputs ("\n");