lkml.org 
[lkml]   [2014]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] kernel/profile.c: use static const char instead of static char
On Wed, 7 May 2014 22:35:08 +0200 Fabian Frederick <fabf@skynet.be> wrote:

> schedstr, sleepstr and kvmstr are only used in strcmp & strlen
>
> ...
>
> --- a/kernel/profile.c
> +++ b/kernel/profile.c
> @@ -52,9 +52,9 @@ static DEFINE_MUTEX(profile_flip_mutex);
>
> int profile_setup(char *str)
> {
> - static char schedstr[] = "schedule";
> - static char sleepstr[] = "sleep";
> - static char kvmstr[] = "kvm";
> + static const char schedstr[] = "schedule";
> + static const char sleepstr[] = "sleep";
> + static const char kvmstr[] = "kvm";
> int par;
>

I'd expect this to either make no change or to make text larger and
data smaller.

In fact,

text data bss dec hex filename
7631 811 3016 11458 2cc2 kernel/profile.o-before
7520 779 3016 11315 2c33 kernel/profile.o-after

Both text and data got smaller and the total reduction was a whopping
143 bytes. Weirdness.



\
 
 \ /
  Last update: 2014-05-08 07:41    [W:0.103 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site