Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Md2fA-000388-MZ for mharc-grub-devel@gnu.org; Mon, 17 Aug 2009 09:54:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Md2f9-00037l-FV for grub-devel@gnu.org; Mon, 17 Aug 2009 09:54:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Md2f4-00036Q-91 for grub-devel@gnu.org; Mon, 17 Aug 2009 09:54:14 -0400 Received: from [199.232.76.173] (port=53427 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Md2f3-00036E-9F for grub-devel@gnu.org; Mon, 17 Aug 2009 09:54:09 -0400 Received: from mail-fx0-f219.google.com ([209.85.220.219]:42683) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Md2f1-0003lM-8R for grub-devel@gnu.org; Mon, 17 Aug 2009 09:54:07 -0400 Received: by fxm19 with SMTP id 19so2446255fxm.2 for ; Mon, 17 Aug 2009 06:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=oXRbjKftasfI72xH6ujO0ZvbdJ6oHR6nY2jVzSWtosU=; b=VT64VcHe0iy9H08CZVjqCL2mKGkvCajyTwRPZYPICWIFqXelA9H4qSb7clJkZUyScu /A38zuClrLv1IT6dPAvJiyQgL9w4yVA/drjarm3HGTePIJloAiF/DiYlrTSGQ2gRxM2Y BsIONlvoNASrcpailVEKRrYk8FWiZBmX9IV0A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=JKJy6e5GyN4ksXRfxj3mB7DnJG4ZAO6uObYi1Jgn98ZJin89oHkuw0oLcCix+7NVLQ 70ypjgeWS8R4cwenWoOIiqysIjjtnIWoSQUZ1KrCgPW7Ya/VF6LvZOqvyWM2Sun7lFW4 cK/LVabqF9zayyzgine4pCqrTDxL79ESKvl2c= MIME-Version: 1.0 Received: by 10.204.7.220 with SMTP id e28mr2741609bke.210.1250517246181; Mon, 17 Aug 2009 06:54:06 -0700 (PDT) In-Reply-To: <20090817134302.GI32551@thorin> References: <20090817134302.GI32551@thorin> Date: Mon, 17 Aug 2009 15:54:06 +0200 Message-ID: From: "Vladimir 'phcoder' Serbinenko" To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] save around 100 bytes on core.img by inlining small misc.c 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: Mon, 17 Aug 2009 13:54:15 -0000 On Mon, Aug 17, 2009 at 3:43 PM, Robert Millan wrote: > On Sat, Aug 15, 2009 at 04:47:32PM +0200, Vladimir 'phcoder' Serbinenko w= rote: >> +static inline char * >> +grub_strncat (char *dest, const char *src, int c) >> +{ >> + =A0char *p =3D dest; >> + >> + =A0while (*p) >> + =A0 =A0p++; >> + >> + =A0while ((*p =3D *src) !=3D '\0' && c--) >> + =A0 =A0{ >> + =A0 =A0 =A0p++; >> + =A0 =A0 =A0src++; >> + =A0 =A0} >> + >> + =A0*p =3D '\0'; >> + >> + =A0return dest; >> +} > > Some of them (like this one) are surprisingly big. =A0Did you test them > separately? Yes I did. My test environment was a core.img with pc+fat+biosdisk. I have a log which functions save how much. In this case inlining strncat saved 21 bytes. The reason for some bigger functions to be inlined is that they are used only in non-size critical parts. In this case it's used in LUA and iso9660.mod (one call). So inlining strncat always saves space (even if iso9660.mod is in core.img but there is no size limit when booting from cd). > > -- > Robert Millan > > =A0The DRM opt-in fallacy: "Your data belongs to us. We will decide when = (and > =A0how) you may access your data; but nobody's threatening your freedom: = we > =A0still allow you to remove your data and not access it at all." > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel > --=20 Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git