Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] unicode: make array 'token' static const, makes object smaller
@ 2019-09-06 13:58 Colin King
  2019-09-06 15:31 ` Theodore Y. Ts'o
  2019-09-09 14:21 ` Gabriel Krisman Bertazi
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-09-06 13:58 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi, linux-fsdevel; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the array 'token' on the stack but instead make it
static const. Makes the object code smaller by 234 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
   5371	    272	      0	   5643	   160b	fs/unicode/utf8-core.o

After:
   text	   data	    bss	    dec	    hex	filename
   5041	    368	      0	   5409	   1521	fs/unicode/utf8-core.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/unicode/utf8-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/unicode/utf8-core.c b/fs/unicode/utf8-core.c
index 71ca4d047d65..2a878b739115 100644
--- a/fs/unicode/utf8-core.c
+++ b/fs/unicode/utf8-core.c
@@ -154,7 +154,7 @@ static int utf8_parse_version(const char *version, unsigned int *maj,
 {
 	substring_t args[3];
 	char version_string[12];
-	const struct match_token token[] = {
+	static const struct match_token token[] = {
 		{1, "%d.%d.%d"},
 		{0, NULL}
 	};
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] unicode: make array 'token' static const, makes object smaller
  2019-09-06 13:58 [PATCH] unicode: make array 'token' static const, makes object smaller Colin King
@ 2019-09-06 15:31 ` Theodore Y. Ts'o
  2019-09-09 14:21 ` Gabriel Krisman Bertazi
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2019-09-06 15:31 UTC (permalink / raw)
  To: Colin King
  Cc: Gabriel Krisman Bertazi, linux-fsdevel, kernel-janitors, linux-kernel

On Fri, Sep 06, 2019 at 02:58:07PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array 'token' on the stack but instead make it
> static const. Makes the object code smaller by 234 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    5371	    272	      0	   5643	   160b	fs/unicode/utf8-core.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    5041	    368	      0	   5409	   1521	fs/unicode/utf8-core.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Nice, thanks!

Reviewed-by: Theodore Ts'o <tytso@mit.edu>

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] unicode: make array 'token' static const, makes object smaller
  2019-09-06 13:58 [PATCH] unicode: make array 'token' static const, makes object smaller Colin King
  2019-09-06 15:31 ` Theodore Y. Ts'o
@ 2019-09-09 14:21 ` Gabriel Krisman Bertazi
  1 sibling, 0 replies; 3+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-09-09 14:21 UTC (permalink / raw)
  To: Colin King; +Cc: linux-fsdevel, kernel-janitors, linux-kernel

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the array 'token' on the stack but instead make it
> static const. Makes the object code smaller by 234 bytes.
>
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    5371	    272	      0	   5643	   160b	fs/unicode/utf8-core.o
>
> After:
>    text	   data	    bss	    dec	    hex	filename
>    5041	    368	      0	   5409	   1521	fs/unicode/utf8-core.o
>
> (gcc version 9.2.1, amd64)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, I will get this queued up.

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 13:58 [PATCH] unicode: make array 'token' static const, makes object smaller Colin King
2019-09-06 15:31 ` Theodore Y. Ts'o
2019-09-09 14:21 ` Gabriel Krisman Bertazi

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org linux-fsdevel@archiver.kernel.org
	public-inbox-index linux-fsdevel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox