public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "André Goddard Rosa" <andre.goddard@gmail.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: laijs@cn.fujitsu.com, mingo@elte.hu, davem@davemloft.net,
	akpm@linux-foundation.org, harvey.harrison@gmail.com,
	linux list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vsprintf: reduce code size, clean up
Date: Sun, 1 Nov 2009 21:00:48 -0200	[thread overview]
Message-ID: <b8bf37780911011500o741bef51sf8a057e2cedcf22c@mail.gmail.com> (raw)
In-Reply-To: <20091101224547.GB5263@nowhere>

Hi, Frederic!

On Sun, Nov 1, 2009 at 8:45 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> On Sun, Nov 01, 2009 at 03:01:40PM -0200, André Goddard Rosa wrote:
>> +static char null[] = "(null)";
>> +
>
>
> This should be static const.
> Also, may be chose a better name, as "null" is too much
> generic and somehow collide with NULL.
>
> null_str ?
>

If I make it a "static const" it's necessary to cast it in two places
to "char *" and code size goes up

lib/vsprintf.c: In function ‘string’:
lib/vsprintf.c:556: warning: assignment discards qualifiers from
pointer target type
lib/vsprintf.c: In function ‘pointer’:
lib/vsprintf.c:828: warning: passing argument 3 of ‘string’ discards
qualifiers from pointer target type
lib/vsprintf.c:551: note: expected ‘char *’ but argument is of type
‘const char *’

   text    data     bss     dec     hex filename
 15383       7       8   15398    3c26 lib/vsprintf.o-static-before
 15431       0       8   15439    3c4f lib/vsprintf.o-static-const-after

as it moves the variable from data section to code section. Is this
the preferred method?


Thanks for reviewing! I'll fix the other points per your suggestions
and post back.

With regards,
André

  reply	other threads:[~2009-11-01 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-01 17:01 [PATCH] vsprintf: reduce code size, clean up André Goddard Rosa
2009-11-01 22:45 ` Frederic Weisbecker
2009-11-01 23:00   ` André Goddard Rosa [this message]
2009-11-01 23:18     ` Frederic Weisbecker
2009-11-02 18:13   ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b8bf37780911011500o741bef51sf8a057e2cedcf22c@mail.gmail.com \
    --to=andre.goddard@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=harvey.harrison@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox