aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2014-08-06 19:09:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:25 -0400
commit142cda5dbcb0dc3738c079f591290d6384261c73 (patch)
tree8ce718779711e5f3be803a86cea30de90963c251 /lib
parente004f3c7780de32fa822f292ebadd985bcadb1e0 (diff)
lib/string_helpers.c: constify static arrays
Complement commit 68aecfb97978 ("lib/string_helpers.c: make arrays static") by making the arrays const -- not only pointing to const strings. This moves them out of the data section to the r/o data section: text data bss dec hex filename 1150 176 0 1326 52e lib/string_helpers.old.o 1326 0 0 1326 52e lib/string_helpers.new.o Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/string_helpers.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index ed5c1454dd62..29033f319aea 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -25,12 +25,15 @@
25int string_get_size(u64 size, const enum string_size_units units, 25int string_get_size(u64 size, const enum string_size_units units,
26 char *buf, int len) 26 char *buf, int len)
27{ 27{
28 static const char *units_10[] = { "B", "kB", "MB", "GB", "TB", "PB", 28 static const char *const units_10[] = {
29 "EB", "ZB", "YB", NULL}; 29 "B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", NULL
30 static const char *units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", 30 };
31 "EiB", "ZiB", "YiB", NULL }; 31 static const char *const units_2[] = {
32 static const char **units_str[] = { 32 "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB",
33 [STRING_UNITS_10] = units_10, 33 NULL
34 };
35 static const char *const *const units_str[] = {
36 [STRING_UNITS_10] = units_10,
34 [STRING_UNITS_2] = units_2, 37 [STRING_UNITS_2] = units_2,
35 }; 38 };
36 static const unsigned int divisor[] = { 39 static const unsigned int divisor[] = {