From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MOFd7-0007hn-7K for mharc-grub-devel@gnu.org; Tue, 07 Jul 2009 14:43:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOFd5-0007h9-NK for grub-devel@gnu.org; Tue, 07 Jul 2009 14:42:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOFd1-0007es-Hb for grub-devel@gnu.org; Tue, 07 Jul 2009 14:42:59 -0400 Received: from [199.232.76.173] (port=36975 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOFd1-0007eg-7t for grub-devel@gnu.org; Tue, 07 Jul 2009 14:42:55 -0400 Received: from aybabtu.com ([69.60.117.155]:33237) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MOFd0-0007DP-Po for grub-devel@gnu.org; Tue, 07 Jul 2009 14:42:55 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1MOEYc-000651-8G for grub-devel@gnu.org; Tue, 07 Jul 2009 19:34:18 +0200 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1MOFcy-0003p4-5u for grub-devel@gnu.org; Tue, 07 Jul 2009 20:42:52 +0200 Date: Tue, 7 Jul 2009 20:42:52 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20090707184252.GC14645@thorin> References: <20090706211303.23809.9322.stgit@mj.roinet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090706211303.23809.9322.stgit@mj.roinet.com> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Subject: Re: [PATCH] Refactor commands/search.c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2009 18:43:00 -0000 On Mon, Jul 06, 2009 at 05:13:03PM -0400, Pavel Roskin wrote: > ChangeLog: > > * commands/search.c (search_file): Merge into ... > (search_fs): ... this. On error, don't output what we were > looking for. Accept search type as argument. > (grub_cmd_search): Pass search type to search_fs(). Very nice work. I've been wanting to do this for a while... > + if (type == SEARCH_FILE) > + { > + grub_size_t len; > + char *p; > + grub_file_t file; > + > + len = grub_strlen (name) + 2 + grub_strlen (key) + 1; > + p = grub_realloc (buf, len); > + if (! p) > + return 1; > + > + buf = p; > + grub_sprintf (buf, "(%s)%s", name, key); > + > + file = grub_file_open (buf); > + if (file) > + { > + found = 1; > + grub_file_close (file); > + } > + } > + else > + { I'd suggest making this clearer by eithe explicitly checking for SEARCH_XXX or otherwise put a comment after the else. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."