From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LuvlJ-000055-SN for mharc-grub-devel@gnu.org; Fri, 17 Apr 2009 17:38:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuvlI-0008WT-A7 for grub-devel@gnu.org; Fri, 17 Apr 2009 17:38:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuvlD-0008VQ-L8 for grub-devel@gnu.org; Fri, 17 Apr 2009 17:38:15 -0400 Received: from [199.232.76.173] (port=57087 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuvlD-0008VK-Fe for grub-devel@gnu.org; Fri, 17 Apr 2009 17:38:11 -0400 Received: from c60.cesmail.net ([216.154.195.49]:40371) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1LuvlD-0004tC-6B for grub-devel@gnu.org; Fri, 17 Apr 2009 17:38:11 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 17 Apr 2009 17:38:10 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id F137034C6D for ; Fri, 17 Apr 2009 17:39:54 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: References: <1239983697.4383.15.camel@mj> Content-Type: text/plain Date: Fri, 17 Apr 2009 17:38:08 -0400 Message-Id: <1240004288.9057.5.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: Eliminating nested functions 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: Fri, 17 Apr 2009 21:38:16 -0000 On Sat, 2009-04-18 at 03:33 +0800, Bean wrote: > Hi, > > One of the advantage of nested function is to use local variables. > Without it, we would need to pass them as global variable, or add > custom data pointer in many of the iterate function, which would make > the code a lot uglier IMO. Indeed, I tried to get rid on nested functions in fs/ext2.c, and it requires more changes than I expected. However, my impression is that everything can be written nicely with more effort. Some arguments could be put into the structures we need to pass, so the number of arguments doesn't increase. We should probably try to avoid adding new nested functions in the meantime. -- Regards, Pavel Roskin