diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2007-10-17 02:29:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:58 -0400 |
commit | b9ec0339d8e22cadf2d9d1b010b51dc53837dfb0 (patch) | |
tree | e7d05e78a68eecc00e656e7e4fdf518967826381 /fs/nls/nls_base.c | |
parent | 37c42524d6090644206ae6d310d7e830bd3ccb47 (diff) |
add consts where appropriate in fs/nls/*
Add const modifiers to a few struct nls_table's member pointers in
include/linux/nls.h and adds a lot of const's in fs/nls/*.c files.
Resulting changes as visible by size:
text data bss dec hex filename
113612 481216 2368 597196 91ccc nls.org/built-in.o
593548 3296 288 597132 91c8c nls/built-in.o
Apparently compiler managed to optimize code a bit better
because of const-ness.
No other changes are made.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nls/nls_base.c')
-rw-r--r-- | fs/nls/nls_base.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 7dfdab98729b..e7905816c4ca 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c | |||
@@ -34,7 +34,7 @@ struct utf8_table { | |||
34 | long lval; | 34 | long lval; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static struct utf8_table utf8_table[] = | 37 | static const struct utf8_table utf8_table[] = |
38 | { | 38 | { |
39 | {0x80, 0x00, 0*6, 0x7F, 0, /* 1 byte sequence */}, | 39 | {0x80, 0x00, 0*6, 0x7F, 0, /* 1 byte sequence */}, |
40 | {0xE0, 0xC0, 1*6, 0x7FF, 0x80, /* 2 byte sequence */}, | 40 | {0xE0, 0xC0, 1*6, 0x7FF, 0x80, /* 2 byte sequence */}, |
@@ -50,7 +50,7 @@ utf8_mbtowc(wchar_t *p, const __u8 *s, int n) | |||
50 | { | 50 | { |
51 | long l; | 51 | long l; |
52 | int c0, c, nc; | 52 | int c0, c, nc; |
53 | struct utf8_table *t; | 53 | const struct utf8_table *t; |
54 | 54 | ||
55 | nc = 0; | 55 | nc = 0; |
56 | c0 = *s; | 56 | c0 = *s; |
@@ -109,7 +109,7 @@ utf8_wctomb(__u8 *s, wchar_t wc, int maxlen) | |||
109 | { | 109 | { |
110 | long l; | 110 | long l; |
111 | int c, nc; | 111 | int c, nc; |
112 | struct utf8_table *t; | 112 | const struct utf8_table *t; |
113 | 113 | ||
114 | if (s == 0) | 114 | if (s == 0) |
115 | return 0; | 115 | return 0; |
@@ -240,7 +240,7 @@ void unload_nls(struct nls_table *nls) | |||
240 | module_put(nls->owner); | 240 | module_put(nls->owner); |
241 | } | 241 | } |
242 | 242 | ||
243 | static wchar_t charset2uni[256] = { | 243 | static const wchar_t charset2uni[256] = { |
244 | /* 0x00*/ | 244 | /* 0x00*/ |
245 | 0x0000, 0x0001, 0x0002, 0x0003, | 245 | 0x0000, 0x0001, 0x0002, 0x0003, |
246 | 0x0004, 0x0005, 0x0006, 0x0007, | 246 | 0x0004, 0x0005, 0x0006, 0x0007, |
@@ -323,7 +323,7 @@ static wchar_t charset2uni[256] = { | |||
323 | 0x00fc, 0x00fd, 0x00fe, 0x00ff, | 323 | 0x00fc, 0x00fd, 0x00fe, 0x00ff, |
324 | }; | 324 | }; |
325 | 325 | ||
326 | static unsigned char page00[256] = { | 326 | static const unsigned char page00[256] = { |
327 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ | 327 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ |
328 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ | 328 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ |
329 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ | 329 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ |
@@ -359,11 +359,11 @@ static unsigned char page00[256] = { | |||
359 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ | 359 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ |
360 | }; | 360 | }; |
361 | 361 | ||
362 | static unsigned char *page_uni2charset[256] = { | 362 | static const unsigned char *const page_uni2charset[256] = { |
363 | page00 | 363 | page00 |
364 | }; | 364 | }; |
365 | 365 | ||
366 | static unsigned char charset2lower[256] = { | 366 | static const unsigned char charset2lower[256] = { |
367 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ | 367 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ |
368 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ | 368 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ |
369 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ | 369 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ |
@@ -399,7 +399,7 @@ static unsigned char charset2lower[256] = { | |||
399 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ | 399 | 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ |
400 | }; | 400 | }; |
401 | 401 | ||
402 | static unsigned char charset2upper[256] = { | 402 | static const unsigned char charset2upper[256] = { |
403 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ | 403 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ |
404 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ | 404 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ |
405 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ | 405 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ |
@@ -438,7 +438,7 @@ static unsigned char charset2upper[256] = { | |||
438 | 438 | ||
439 | static int uni2char(wchar_t uni, unsigned char *out, int boundlen) | 439 | static int uni2char(wchar_t uni, unsigned char *out, int boundlen) |
440 | { | 440 | { |
441 | unsigned char *uni2charset; | 441 | const unsigned char *uni2charset; |
442 | unsigned char cl = uni & 0x00ff; | 442 | unsigned char cl = uni & 0x00ff; |
443 | unsigned char ch = (uni & 0xff00) >> 8; | 443 | unsigned char ch = (uni & 0xff00) >> 8; |
444 | 444 | ||