Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/string_helpers.c: make arrays static

Moving these arrays into static storage shrinks the kernel a bit:

text data bss dec hex filename
723 112 64 899 383 lib/string_helpers.o
516 272 64 852 354 lib/string_helpers.o

Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andrew Morton and committed by
Linus Torvalds
68aecfb9 26d7b99b

+4 -4
+4 -4
lib/string_helpers.c
··· 23 23 int string_get_size(u64 size, const enum string_size_units units, 24 24 char *buf, int len) 25 25 { 26 - const char *units_10[] = { "B", "kB", "MB", "GB", "TB", "PB", 26 + static const char *units_10[] = { "B", "kB", "MB", "GB", "TB", "PB", 27 27 "EB", "ZB", "YB", NULL}; 28 - const char *units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", 28 + static const char *units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", 29 29 "EiB", "ZiB", "YiB", NULL }; 30 - const char **units_str[] = { 30 + static const char **units_str[] = { 31 31 [STRING_UNITS_10] = units_10, 32 32 [STRING_UNITS_2] = units_2, 33 33 }; 34 - const unsigned int divisor[] = { 34 + static const unsigned int divisor[] = { 35 35 [STRING_UNITS_10] = 1000, 36 36 [STRING_UNITS_2] = 1024, 37 37 };