All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
@ 2005-05-26 15:25 Ricardo Nabinger Sanchez
  2005-05-26 16:35 ` Alexey Dobriyan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ricardo Nabinger Sanchez @ 2005-05-26 15:25 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

o Fixes strings declaration from char *str = ""; to char str[] = "";,
  avoiding the extra pointer, as noted by Jeff Garzik.  The strings'
  contents are not changed after declared.

 arch/cris/arch-v10/drivers/axisflashmap.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Ricardo Nabinger Sanchez <rnsanchez@terra.com.br>

[-- Attachment #2: string_fix_arch_cris.patch --]
[-- Type: text/plain, Size: 781 bytes --]

diff -urNp -X dontdiff linux-2.6.11.10/arch/cris/arch-v10/drivers/axisflashmap.c mod-linux-2.6.11.10/arch/cris/arch-v10/drivers/axisflashmap.c
--- linux-2.6.11.10/arch/cris/arch-v10/drivers/axisflashmap.c	2005-05-16 14:50:30.000000000 -0300
+++ mod-linux-2.6.11.10/arch/cris/arch-v10/drivers/axisflashmap.c	2005-05-25 23:59:46.000000000 -0300
@@ -393,7 +393,7 @@ static int __init init_axis_flash(void)
 	struct partitiontable_head *ptable_head = NULL;
 	struct partitiontable_entry *ptable;
 	int use_default_ptable = 1; /* Until proven otherwise. */
-	const char *pmsg = "  /dev/flash%d at 0x%08x, size 0x%08x\n";
+	const char pmsg[] = "  /dev/flash%d at 0x%08x, size 0x%08x\n";
 
 	if (!(mymtd = flash_probe())) {
 		/* There's no reason to use this module if no flash chip can

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
  2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
@ 2005-05-26 16:35 ` Alexey Dobriyan
  2005-05-26 17:21 ` Ricardo Nabinger Sanchez
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2005-05-26 16:35 UTC (permalink / raw)
  To: kernel-janitors

On Thursday 26 May 2005 19:25, Ricardo Nabinger Sanchez wrote:
> o Fixes strings declaration from char *str = ""; to char str[] = "";,
>   avoiding the extra pointer, as noted by Jeff Garzik.

>  arch/cris/arch-v10/drivers/axisflashmap.c |    2 +-

What's the difference in .text and .data sizes?
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
  2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
  2005-05-26 16:35 ` Alexey Dobriyan
@ 2005-05-26 17:21 ` Ricardo Nabinger Sanchez
  2005-05-26 17:58 ` Alexey Dobriyan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ricardo Nabinger Sanchez @ 2005-05-26 17:21 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

Quoting  Alexey Dobriyan <adobriyan@gmail.com>
Sent on  Thu, 26 May 2005 20:35:55 +0400

> What's the difference in .text and .data sizes?

It's small, but as there are lots of occurences which may be corrected
(there are about 475 in total, including those which must be done that
way -- ie, correct).

From the TODO:

=====
From: Jeff Garzik <jgarzik at mandrakesoft dot com>

1) The string form

        [const] char *foo = "blah";

creates two variables in the final assembly output, a static string, and
a char pointer to the static string.  The alternate string form

        [const] char foo[] = "blah";

is better because it declares a single variable.
...
=====


-- 
Ricardo Nabinger Sanchez
GNU/Linux #140696 [http://counter.li.org]
Slackware Linux + FreeBSD

    How long a minute is depends on which 
    side of the bathroom door you're on.


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
  2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
  2005-05-26 16:35 ` Alexey Dobriyan
  2005-05-26 17:21 ` Ricardo Nabinger Sanchez
@ 2005-05-26 17:58 ` Alexey Dobriyan
  2005-05-26 18:27 ` walter harms
  2005-05-26 18:47 ` Alexey Dobriyan
  4 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2005-05-26 17:58 UTC (permalink / raw)
  To: kernel-janitors

On Thursday 26 May 2005 21:21, Ricardo Nabinger Sanchez wrote:
> Quoting  Alexey Dobriyan <adobriyan@gmail.com>
> Sent on  Thu, 26 May 2005 20:35:55 +0400
> 
> > What's the difference in .text and .data sizes?
> 
> It's small,

I want to see size(1) output on cross-compiled .o

IIRC the difference depends on gcc version and can even be positive.

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
  2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
                   ` (2 preceding siblings ...)
  2005-05-26 17:58 ` Alexey Dobriyan
@ 2005-05-26 18:27 ` walter harms
  2005-05-26 18:47 ` Alexey Dobriyan
  4 siblings, 0 replies; 6+ messages in thread
From: walter harms @ 2005-05-26 18:27 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

hi Alexey,
you ask for it :)

  cris-gcc -v
Reading specs from /usr/local/cris/lib/gcc-lib/cris/2.96/specs
gcc version 2.96 Axis release R46/1.25

testprogramm:

#include <stdio.h>
//char *foo = "blah";
char foo[]="blah";
int main()
{
printf("%s\n",foo);

}

  size test_string  (char [])
    text    data     bss     dec     hex filename
     769     252      36    1057     421 test_string


size test_string2  (char *)
    text    data     bss     dec     hex filename
     777     248      40    1065     429 test_string2


sorry, i could not resist :)

re,
	walter



Alexey Dobriyan wrote:
> On Thursday 26 May 2005 21:21, Ricardo Nabinger Sanchez wrote:
> 
>>Quoting  Alexey Dobriyan <adobriyan@gmail.com>
>>Sent on  Thu, 26 May 2005 20:35:55 +0400
>>
>>
>>>What's the difference in .text and .data sizes?
>>
>>It's small,
> 
> 
> I want to see size(1) output on cross-compiled .o
> 
> IIRC the difference depends on gcc version and can even be positive.
> 


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration
  2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
                   ` (3 preceding siblings ...)
  2005-05-26 18:27 ` walter harms
@ 2005-05-26 18:47 ` Alexey Dobriyan
  4 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2005-05-26 18:47 UTC (permalink / raw)
  To: kernel-janitors

On Thursday 26 May 2005 22:27, walter harms wrote:

> you ask for it :)
> 
>   cris-gcc -v
> Reading specs from /usr/local/cris/lib/gcc-lib/cris/2.96/specs
> gcc version 2.96 Axis release R46/1.25

Aha!

> #include <stdio.h>
> //char *foo = "blah";
> char foo[]="blah";
> int main()
> {
> printf("%s\n",foo);
> 
> }
> 
>   size test_string  (char [])
>     text    data     bss     dec     hex filename
>      769     252      36    1057     421 test_string
> 
> 
> size test_string2  (char *)
>     text    data     bss     dec     hex filename
>      777     248      40    1065     429 test_string2
> 
> 
> sorry, i could not resist :)

Care to repeat this on arch/cris/arch-v10/drivers/axisflashmap.o ? ;-)
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-26 18:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-26 15:25 [KJ] [PATCH 2.6.11.10] arch/cris: fixes static strings declaration Ricardo Nabinger Sanchez
2005-05-26 16:35 ` Alexey Dobriyan
2005-05-26 17:21 ` Ricardo Nabinger Sanchez
2005-05-26 17:58 ` Alexey Dobriyan
2005-05-26 18:27 ` walter harms
2005-05-26 18:47 ` Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.