Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mg267-0003m3-KO for mharc-grub-devel@gnu.org; Tue, 25 Aug 2009 15:54:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mg264-0003lK-Qr for grub-devel@gnu.org; Tue, 25 Aug 2009 15:54:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mg260-0003ko-E8 for grub-devel@gnu.org; Tue, 25 Aug 2009 15:54:24 -0400 Received: from [199.232.76.173] (port=55422 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mg260-0003kl-94 for grub-devel@gnu.org; Tue, 25 Aug 2009 15:54:20 -0400 Received: from xvm-190-8.ghst.net ([217.70.190.8]:47264 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mg25z-00045l-Ne for grub-devel@gnu.org; Tue, 25 Aug 2009 15:54:19 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1Mg25l-0008TD-Kx; Tue, 25 Aug 2009 21:54:05 +0200 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1Mg25l-0005gT-2S; Tue, 25 Aug 2009 21:54:05 +0200 Date: Tue, 25 Aug 2009 21:54:05 +0200 From: Robert Millan To: Joe Auricchio Message-ID: <20090825195405.GG21446@thorin> References: <8FB98151-B0A2-4308-A065-15607AE9E8D8@gmail.com> <20090718185800.GJ8867@thorin> <0CC61931-97E9-4B53-8B86-37129AE84218@gmail.com> <20090722172709.GF8706@thorin> <1F7F9766-ABCD-4190-AA2D-C028D6348094@gmail.com> <20090823130713.GD22272@thorin> <793523500908241745t63969e94gf54a3b285ceea253@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <793523500908241745t63969e94gf54a3b285ceea253@mail.gmail.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, 3) Cc: The development of GRUB 2 Subject: Re: [PATCH] Clear out gfxterm's virtual text_buffer - fixes junk at end of lines 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, 25 Aug 2009 19:54:25 -0000 On Mon, Aug 24, 2009 at 05:45:15PM -0700, Joe Auricchio wrote: > On Sun, Aug 23, 2009 at 06:07, Robert Millan wrote: > > On Wed, Jul 22, 2009 at 10:42:54AM -0700, Joe Auricchio wrote: > >>> > >>> So perhaps this can be solved simpler by replacing grub_malloc with > >>> grub_zalloc ? > >> > >> I saw the zalloc commit and thought the same thing! :D I'll test it. But > >> fg_color and bg_color must be set to the screen's current colors, which > >> may not be zero. > >> > >> I just discovered that > >> - this patch to grub_virtual_screen_setup() > >> - scroll_up() line 579 /* Clear last line in text buffer. */, and > >> - grub_virtual_screen_cls() > >> do the same thing. > >> > >> An opportunity to refactor? I'll look into this. > > > > Hi, > > > > Note that the initial patch was committed due to lack of coordination (there's > > been a period in which we've been sloppy due to lack of leadership, but this > > won't happen again). > > > > Nevertheless, the initial approach is probably not correct;  my impression > > is that it should be using grub_zalloc() instead.  If you're still interested, > > I'd appreciate if you could fix that. > > Using zalloc only makes sense in grub_virtual_screen_setup, when the > buffer is allocated. But the clear_chars loop is used thrice: in > _setup, in grub_virtual_screen_cls, and in scroll_up. > > Freeing and allocating a new buffer for each cls or scroll is clearly > insane. So the zalloc can't be in the common function. > > The goal of this refactor was to centralize the code for visually > clearing the text buffer. So it doesn't make sense to have _setup use > zalloc but have _cls and scroll_up use a loop without zalloc: then > what has been refactored? > > It seemed like a nice idea to use zalloc, but this code isn't the > right nail for that hammer. :) > > Let me know how you want to proceed. If you'd still like to use zalloc > I can adjust the patch. No. When I suggested zalloc I hadn't looked at this in detail (and I still haven't). I was under the impression that you considered zalloc was suitable. If that's not the case, then there's nothing more to say. Thanks for your explanation! -- 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."