Patch to change char * into char[]
Subsystems (2)
Hello,
Attached is a patch to convert a few instances of 'char *foo = "bar";' into 'char foo[] = "bar";'. I started off with drivers/net/irda, I'll do some more if everything is OK with this one.
Peter.
Binary files linux-2.6.4-kj-orig/drivers/net/irda/.irport.c.swp and linux-2.6.4/drivers/net/irda/.irport.c.swp differ
drivers/net/irda/ali-ircc.c +1 -1
@@ -49,7 +49,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="ali-ircc" ; +static char driver_name[] ="ali-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
drivers/net/irda/irport.c +1 -1
@@ -72,7 +72,7 @@static unsigned int qos_mtt_bits =0x03 ;static struct irport_cb *dev_self[] = {NULL ,NULL ,NULL ,NULL }; -static char *driver_name ="irport" ; +static char driver_name[] ="irport" ;static inline void irport_write_wakeup (struct irport_cb *self);static inline int irport_write (int iobase,int fifo_size,__u8 *buf,int len);
drivers/net/irda/nsc-ircc.c +1 -1
@@ -68,7 +68,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="nsc-ircc" ; +static char driver_name[] ="nsc-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
drivers/net/irda/via-ircc.c +1 -1
@@ -65,7 +65,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="via-ircc" ; +static char driver_name[] ="via-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
drivers/net/irda/w83977af_ir.c +1 -1
@@ -69,7 +69,7 @@#define CONFIG_USE_W977_PNP /* Currently needed */ #define PIO_MAX_SPEED 115200 -static char *driver_name ="w83977af_ir" ; +static char driver_name[] ="w83977af_ir" ;static int qos_mtt_bits =0x07 ;/* 1 ms or more */ #define CHIP_IO_EXTENT 8
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
hello peter,
Quoted 3 lines · Peter McCurdy
Attached is a patch to convert a few instances of 'char *foo = "bar";' into 'char foo[] = "bar";'. I started off with
drivers/net/irda, I'll do some more if everything is OK with this one.
good starter, applied and compiled.
but please send in 1 patch / mail inline
(it's easier to save the hole patch with comment for further usage..)
add the output of size(1) for this kind of patches some of these are beneficial but not all. :)
Quoted 1 line
Binary files linux-2.6.4-kj-orig/drivers/net/irda/.irport.c.swp and linux-2.6.4/drivers/net/irda/.irport.c.swp differ
diff has a -X switch for a "dontdiff" file, like this one:
http://developer.osdl.org/rddunlap/scripts/dontdiff-osdl
drivers/net/irda/ali-ircc.c line 55
Quoted 12 lines
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.clinux-2.6.4/drivers/net/irda/ali-ircc.cdrivers/net/irda/ali-ircc.c +1
-1@@ -49,7 +49,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="ali-ircc" ; +static char driver_name[] ="ali-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
first line size(1) output is before your patch, 2 line after.
text data bss dec hex filename
17575 784 48 18407 47e7 ali-ircc.o 17582 784 48 18414 47ee ali-ircc.o
didn't help.
drivers/net/irda/irport.c line 78
Quoted 12 lines
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/irport.clinux-2.6.4/drivers/net/irda/irport.cdrivers/net/irda/irport.c +1
-1@@ -72,7 +72,7 @@static unsigned int qos_mtt_bits =0x03 ;static struct irport_cb *dev_self[] = {NULL ,NULL ,NULL ,NULL }; -static char *driver_name ="irport" ; +static char driver_name[] ="irport" ;static inline void irport_write_wakeup (struct irport_cb *self);static inline int irport_write (int iobase,int fifo_size,__u8 *buf,int len);
text data bss dec hex filename
7538 536 32 8106 1faa irport.o 7531 539 32 8102 1fa6 irport.o
looks good to me.
drivers/net/irda/nsc-ircc.c line 74
Quoted 12 lines
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/nsc-ircc.clinux-2.6.4/drivers/net/irda/nsc-ircc.cdrivers/net/irda/nsc-ircc.c +1
-1@@ -68,7 +68,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="nsc-ircc" ; +static char driver_name[] ="nsc-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
text data bss dec hex filename 14375 1120 60 15555 3cc3 nsc-ircc.o 14401 1120 60 15581 3cdd nsc-ircc.o
bad.
drivers/net/irda/via-ircc.c line 71
Quoted 12 lines
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/via-ircc.clinux-2.6.4/drivers/net/irda/via-ircc.cdrivers/net/irda/via-ircc.c +1
-1@@ -65,7 +65,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="via-ircc" ; +static char driver_name[] ="via-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */
text data bss dec hex filename
15232 760 16 16008 3e88 via-ircc.o 15232 760 16 16008 3e88 via-ircc.o
no change.
drivers/net/irda/w83977af_ir.c line 75
Quoted 12 lines
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/w83977af_ir.clinux-2.6.4/drivers/net/irda/w83977af_ir.cdrivers/net/irda/w83977af_ir.c +1
-1@@ -69,7 +69,7 @@#define CONFIG_USE_W977_PNP /* Currently needed */ #define PIO_MAX_SPEED 115200 -static char *driver_name ="w83977af_ir" ; +static char driver_name[] ="w83977af_ir" ;static int qos_mtt_bits =0x07 ;/* 1 ms or more */ #define CHIP_IO_EXTENT 8
text data bss dec hex filename
8323 708 16 9047 2357 w83977af_ir.o 8311 716 16 9043 2353 w83977af_ir.o
this one is ok.
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 18 lines · maximilian attems
hello peter,
drivers/net/irda/ali-ircc.c line 55
Quoted 12 lines · Peter McCurdy
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.clinux-2.6.4/drivers/net/irda/ali-ircc.cdrivers/net/irda/ali-ircc.c +1
-1@@ -49,7 +49,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="ali-ircc" ; +static char driver_name[] ="ali-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */ first line size(1) output is before your patch, 2 line after.
Quoted 5 lines
text data bss dec hex filename
17575 784 48 18407 47e7 ali-ircc.o 17582 784 48 18414 47ee ali-ircc.odidn't help.
text data bss dec hex filename
11669 152 48 11869 2e5d drivers/net/irda/ali-ircc.o # char *driver_name 11660 152 48 11860 2e54 drivers/net/irda/ali-ircc.o # char driver_name[] 11669 152 48 11869 2e5d drivers/net/irda/ali-ircc.o # const char driver_name[]
Did help! :-) (gcc version 3.3.3, compiled with make drivers/net/irda/ali-ircc.o) If you want, i can check others too.
Any idea why const version is longer?
Domen
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 23 lines · Domen Puncer
Quoted 22 lines · maximilian attems
hello peter,
drivers/net/irda/ali-ircc.c line 55
Quoted 12 lines · Peter McCurdy
diff -ruN
linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.clinux-2.6.4/drivers/net/irda/ali-ircc.cdrivers/net/irda/ali-ircc.c +1
-1@@ -49,7 +49,7 @@#define CHIP_IO_EXTENT 8#define BROKEN_DONGLE_ID -static char *driver_name ="ali-ircc" ; +static char driver_name[] ="ali-ircc" ;/* Module parameters */ static int qos_mtt_bits =0x07 ;/* 1 ms or more */ first line size(1) output is before your patch, 2 line after.
text data bss dec hex filename
17575 784 48 18407 47e7 ali-ircc.o 17582 784 48 18414 47ee ali-ircc.o
Quoted 8 lines
Quoted 1 line
didn't help.
text data bss dec hex filename
11669 152 48 11869 2e5d drivers/net/irda/ali-ircc.o # char *driver_name 11660 152 48 11860 2e54 drivers/net/irda/ali-ircc.o # char driver_name[] 11669 152 48 11869 2e5d drivers/net/irda/ali-ircc.o # const char driver_name[]Did help! :-) (gcc version 3.3.3, compiled with make
drivers/net/irda/ali-ircc.o)
woow
just double checked my own values,
compared to yours incredible size difference!!
but the overall trend seems the same.
Quoted 1 line
If you want, i can check others too.
yeeah
these 2 patches from current kj-patchset should be double checked with size(1)
i can look at them tomorrow morning, but if you like in between?
at:
http://developer.osdl.org/rddunlap/kj-patches/2.6.4-rc2/split/patches/
add/ keyboard_ptr_to_string.patch
From: Luiz Fernando Capitulino <[email protected]>
add/ string_form_drivers.patch
From: maximilian attems <[email protected]>
regards maks
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 11 lines · you
Quoted 9 lines · Domen Puncer
Quoted 5 lines · maximilian attems
text data bss dec hex filename
17575 784 48 18407 47e7 ali-ircc.o 17582 784 48 18414 47ee ali-ircc.odidn't help.
text data bss dec hex filename
11669 152 48 11869 2e5ddrivers/net/irda/ali-ircc.o# char
*driver_name
Quoted 1 line
Quoted 1 line
11660 152 48 11860 2e54
drivers/net/irda/ali-ircc.o# char
driver_name[]
Quoted 1 line
Quoted 1 line
11669 152 48 11869 2e5d
drivers/net/irda/ali-ircc.o#
const char driver_name[]
Quoted 2 lines
Quoted 2 lines
Did help! :-) (gcc version 3.3.3, compiled with make
drivers/net/irda/
ali-ircc.o)
Quoted 4 lines
woow
just double checked my own values,
compared to yours incredible size difference!!
Yeah, amazing.
Quoted 1 line
but the overall trend seems the same.
heh? mine shows improvements with the patch, yours regressions.
Quoted 8 lines
Quoted 2 lines
If you want, i can check others too.
yeeah
these 2 patches from current kj-patchset should be double checked with size(1)
i can look at them tomorrow morning, but if you like in between?
Just enough drunk to do this now :-)
Quoted 2 lines
add/ keyboard_ptr_to_string.patch
From: Luiz Fernando Capitulino <[email protected]>
before:
text data bss dec hex filename 7113 1364 492 8969 2309 drivers/char/keyboard.o
after:
7116 1364 492 8972 230c drivers/char/keyboard.o
Quoted 2 lines
add/ string_form_drivers.patch
From: maximilian attems <[email protected]>
text data bss dec hex filename
48230 487 4592 53309 d03d drivers/cdrom/sbpcd.o 48232 455 4592 53279 d01f drivers/cdrom/sbpcd.o 44535 897 240 45672 b268 drivers/message/fusion/mptscsi 44537 897 240 45674 b26a drivers/message/fusion/mptscsi 6057 112 84 6253 186d drivers/net/appletalk/cops.o 6047 112 84 6243 1863 drivers/net/appletalk/cops.o 13770 496 26 14292 37d4 drivers/net/irda/smsc-ircc2.o 13757 464 26 14247 37a7 drivers/net/irda/smsc-ircc2.o 4562 36 16 4614 1206 drivers/net/ni5010.o 4498 91 16 4605 11fd drivers/net/ni5010.o
Mostly this is an improvoment, but wtf not allways? How can one pointer less take up more space? What am i missing?
Domen
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors