lkml.org 
[lkml]   [2012]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] memcg: Use scnprintf instead of sprintf
Date
Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
writes:

> diff -puN lib/string_helpers.c~lib-string_helpersc-make-arrays-static lib/string_helpers.c
> --- a/lib/string_helpers.c~lib-string_helpersc-make-arrays-static
> +++ a/lib/string_helpers.c
> @@ -23,15 +23,15 @@
> int string_get_size(u64 size, const enum string_size_units units,
> char *buf, int len)
> {
> - const char *units_10[] = { "B", "kB", "MB", "GB", "TB", "PB",
> + static const char *units_10[] = { "B", "kB", "MB", "GB", "TB", "PB",
> "EB", "ZB", "YB", NULL};
> - const char *units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB",
> + static const char *units_2[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB",
> "EiB", "ZiB", "YiB", NULL };
> - const char **units_str[] = {
> + static const char **units_str[] = {
> [STRING_UNITS_10] = units_10,
> [STRING_UNITS_2] = units_2,
> };

You could even make them const, I think.

Andreas.

--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


\
 
 \ /
  Last update: 2012-04-19 10:29    [W:0.049 / U:10.276 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site