From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Lsz5O-0006uO-3I for mharc-grub-devel@gnu.org; Sun, 12 Apr 2009 08:46:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lsz5L-0006sI-Tk for grub-devel@gnu.org; Sun, 12 Apr 2009 08:46:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lsz5G-0006ox-9z for grub-devel@gnu.org; Sun, 12 Apr 2009 08:46:54 -0400 Received: from [199.232.76.173] (port=60627 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lsz5G-0006ou-5W for grub-devel@gnu.org; Sun, 12 Apr 2009 08:46:50 -0400 Received: from fg-out-1718.google.com ([72.14.220.154]:21514) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lsz5F-000870-Io for grub-devel@gnu.org; Sun, 12 Apr 2009 08:46:49 -0400 Received: by fg-out-1718.google.com with SMTP id 19so509178fgg.7 for ; Sun, 12 Apr 2009 05:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=tKAQtJPYFewXDZ+iuwgXGlUmqdrXS2JtZBBlAjzHxqw=; b=BE7u3+LpPa2aS4cWGiyNhJREehAbzG3cYVaMJoXPo16eX9Po/AolTYSmvC1GQ7GeLA f03bKJrBp8izNSVZsrUyek7VH37t/cH3aU3gmutQps6hDQ1VteGRB3j7DUWfBpixwR9/ Yoyk/6xA/qB7+v14ZU7MVSqMsjTuuY1Q8BOW4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=qz0gckMGD9VPCQz45ZCKn+Ioy6Rpo9mFIgg7keBp68AxW0+NpYiU40Tn78iZq0Xyfy NTB3ooNl3nbB8I7NpsABavkXyXiO9pFCUIBFujEc0vCPDxOSQy8EMNzYfhobHjxXbPGz vUWkEB7EmjaLZ07K9q4Rn7qN252+r03z9QPM8= Received: by 10.86.50.8 with SMTP id x8mr2410378fgx.1.1239540408577; Sun, 12 Apr 2009 05:46:48 -0700 (PDT) Received: from ?192.168.1.25? (116-145.62-81.cust.bluewin.ch [81.62.145.116]) by mx.google.com with ESMTPS id 12sm5478916fgg.7.2009.04.12.05.46.47 (version=SSLv3 cipher=RC4-MD5); Sun, 12 Apr 2009 05:46:48 -0700 (PDT) Message-ID: <49E1E2BC.3020405@gmail.com> Date: Sun, 12 Apr 2009 14:46:52 +0200 From: phcoder User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: David Miller References: <200904111919.49761.okuji@enbug.org> <20090411.044848.183598331.davem@davemloft.net> <49E0EB22.4070308@gmail.com> <20090412.010719.229891360.davem@davemloft.net> In-Reply-To: <20090412.010719.229891360.davem@davemloft.net> Content-Type: multipart/mixed; boundary="------------070703040003070507080304" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: grub-devel@gnu.org Subject: Re: [PATCH]: grub: Fix handling of long printf arguments on 64-bit. 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: Sun, 12 Apr 2009 12:46:56 -0000 This is a multi-part message in MIME format. --------------070703040003070507080304 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Miller wrote: > From: phcoder > Date: Sat, 11 Apr 2009 21:10:26 +0200 > >> I do not agree with having separate grub_itoa/grub_ltoa/grub_lltoa in >> kernel where the size is critical. We should have only lltoa and use >> it in all contexts. > > I look forward to your patch implementing this improvement :-) > -- Regards Vladimir 'phcoder' Serbinenko --------------070703040003070507080304 Content-Type: text/x-diff; name="lltoa.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="lltoa.diff" diff --git a/ChangeLog b/ChangeLog index 237c6f4..d701519 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-04-12 Vladimir Serbinenko + + use grub_lltoa instead of grub_itoa and grub_ltoa for all purposes + + * kern/misc.c (grub_itoa): Removed function + (grub_ltoa): likewise + (grub_vsprintf): use grub_lltoa + 2009-04-12 David S. Miller * kern/misc.c (grub_ltoa): Fix cast when handling negative diff --git a/kern/misc.c b/kern/misc.c index 5a12535..70abb33 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -565,56 +565,6 @@ grub_reverse (char *str) } } -static char * -grub_itoa (char *str, int c, unsigned n) -{ - unsigned base = (c == 'x') ? 16 : 10; - char *p; - - if ((int) n < 0 && c == 'd') - { - n = (unsigned) (-((int) n)); - *str++ = '-'; - } - - p = str; - do - { - unsigned d = n % base; - *p++ = (d > 9) ? d + 'a' - 10 : d + '0'; - } - while (n /= base); - *p = 0; - - grub_reverse (str); - return p; -} - -static char * -grub_ltoa (char *str, int c, unsigned long n) -{ - unsigned long base = (c == 'x') ? 16 : 10; - char *p; - - if ((long) n < 0 && c == 'd') - { - n = (unsigned long) (-((long) n)); - *str++ = '-'; - } - - p = str; - do - { - unsigned long d = n % base; - *p++ = (d > 9) ? d + 'a' - 10 : d + '0'; - } - while (n /= base); - *p = 0; - - grub_reverse (str); - return p; -} - /* Divide N by D, return the quotient, and store the remainder in *R. */ grub_uint64_t grub_divmod64 (grub_uint64_t n, grub_uint32_t d, grub_uint32_t *r) @@ -818,12 +768,12 @@ grub_vsprintf (char *str, const char *fmt, va_list args) else if (longfmt) { long l = va_arg (args, long); - grub_ltoa (tmp, c, l); + grub_lltoa (tmp, c, l); } else { n = va_arg (args, int); - grub_itoa (tmp, c, n); + grub_lltoa (tmp, c, n); } if (! rightfill && grub_strlen (tmp) < format1) write_fill (zerofill, format1 - grub_strlen (tmp)); --------------070703040003070507080304--