unicode: make array 'token' static const, makes object smaller
Subsystems (3)
PATCH 1/1 unicode: make array 'token' static const, makes object smaller
From: Colin Ian King <[email protected]>
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)
--- fs/unicode/utf8-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/unicode/utf8-core.c +1 -1
@@ -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 } };
Signature · 1 line
2.20.1
Quoted 9 lines · Colin King
From: Colin Ian King <[email protected]>
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 160bfs/unicode/utf8-core.o
Quoted 7 lines
After:
text data bss dec hex filename
5041 368 0 5409 1521fs/unicode/utf8-core.o(gcc version 9.2.1, amd64)
Signed-off-by Colin Ian King <[email protected]>
Nice, thanks!
- Ted
Quoted 9 lines · Colin King
From: Colin Ian King <[email protected]>
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 160bfs/unicode/utf8-core.o
Quoted 7 lines
After:
text data bss dec hex filename
5041 368 0 5409 1521fs/unicode/utf8-core.o(gcc version 9.2.1, amd64)
Signed-off-by Colin Ian King <[email protected]>
Thanks, I will get this queued up.
Signature · 1 line
Gabriel Krisman Bertazi