* [Kernel-janitors] Patch to change char * into char[]
@ 2004-03-12 16:44 Peter McCurdy
2004-03-16 8:25 ` maximilian attems
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Peter McCurdy @ 2004-03-12 16:44 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 208 bytes --]
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.
[-- Attachment #2: char-array-irda.patch --]
[-- Type: text/plain, Size: 2679 bytes --]
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 -ruN linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c linux-2.6.4/drivers/net/irda/ali-ircc.c
--- linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c Fri Mar 12 10:15:01 2004
+++ linux-2.6.4/drivers/net/irda/ali-ircc.c Fri Mar 12 10:47:24 2004
@@ -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 */
diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/irport.c linux-2.6.4/drivers/net/irda/irport.c
--- linux-2.6.4-kj-orig/drivers/net/irda/irport.c Fri Mar 12 10:15:01 2004
+++ linux-2.6.4/drivers/net/irda/irport.c Fri Mar 12 10:47:32 2004
@@ -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);
diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/nsc-ircc.c linux-2.6.4/drivers/net/irda/nsc-ircc.c
--- linux-2.6.4-kj-orig/drivers/net/irda/nsc-ircc.c Fri Mar 12 10:15:01 2004
+++ linux-2.6.4/drivers/net/irda/nsc-ircc.c Fri Mar 12 10:46:51 2004
@@ -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 */
diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/via-ircc.c linux-2.6.4/drivers/net/irda/via-ircc.c
--- linux-2.6.4-kj-orig/drivers/net/irda/via-ircc.c Fri Mar 12 10:15:01 2004
+++ linux-2.6.4/drivers/net/irda/via-ircc.c Fri Mar 12 10:46:40 2004
@@ -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 */
diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/w83977af_ir.c linux-2.6.4/drivers/net/irda/w83977af_ir.c
--- linux-2.6.4-kj-orig/drivers/net/irda/w83977af_ir.c Fri Mar 12 10:15:01 2004
+++ linux-2.6.4/drivers/net/irda/w83977af_ir.c Fri Mar 12 10:47:02 2004
@@ -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
[-- Attachment #3: Type: text/plain, Size: 163 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] Patch to change char * into char[]
2004-03-12 16:44 [Kernel-janitors] Patch to change char * into char[] Peter McCurdy
@ 2004-03-16 8:25 ` maximilian attems
2004-03-16 19:23 ` Domen Puncer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: maximilian attems @ 2004-03-16 8:25 UTC (permalink / raw)
To: kernel-janitors
hello peter,
On Fri, 12 Mar 2004, Peter McCurdy wrote:
> 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. :)
> 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
> diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c linux-2.6.4/drivers/net/irda/ali-ircc.c
> --- linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c Fri Mar 12 10:15:01 2004
> +++ linux-2.6.4/drivers/net/irda/ali-ircc.c Fri Mar 12 10:47:24 2004
> @@ -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.
> diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/irport.c linux-2.6.4/drivers/net/irda/irport.c
> --- linux-2.6.4-kj-orig/drivers/net/irda/irport.c Fri Mar 12 10:15:01 2004
> +++ linux-2.6.4/drivers/net/irda/irport.c Fri Mar 12 10:47:32 2004
> @@ -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.
> diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/nsc-ircc.c linux-2.6.4/drivers/net/irda/nsc-ircc.c
> --- linux-2.6.4-kj-orig/drivers/net/irda/nsc-ircc.c Fri Mar 12 10:15:01 2004
> +++ linux-2.6.4/drivers/net/irda/nsc-ircc.c Fri Mar 12 10:46:51 2004
> @@ -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.
> diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/via-ircc.c linux-2.6.4/drivers/net/irda/via-ircc.c
> --- linux-2.6.4-kj-orig/drivers/net/irda/via-ircc.c Fri Mar 12 10:15:01 2004
> +++ linux-2.6.4/drivers/net/irda/via-ircc.c Fri Mar 12 10:46:40 2004
> @@ -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.
> diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/w83977af_ir.c linux-2.6.4/drivers/net/irda/w83977af_ir.c
> --- linux-2.6.4-kj-orig/drivers/net/irda/w83977af_ir.c Fri Mar 12 10:15:01 2004
> +++ linux-2.6.4/drivers/net/irda/w83977af_ir.c Fri Mar 12 10:47:02 2004
> @@ -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
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] Patch to change char * into char[]
2004-03-12 16:44 [Kernel-janitors] Patch to change char * into char[] Peter McCurdy
2004-03-16 8:25 ` maximilian attems
@ 2004-03-16 19:23 ` Domen Puncer
2004-03-16 20:18 ` maximilian attems
2004-03-17 1:24 ` Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-16 19:23 UTC (permalink / raw)
To: kernel-janitors
On Tuesday 16 of March 2004 09:25, maximilian attems wrote:
> hello peter,
>
> On Fri, 12 Mar 2004, Peter McCurdy wrote:
> > diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c linux-2.6.4/drivers/net/irda/ali-ircc.c
> > --- linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c Fri Mar 12 10:15:01 2004
> > +++ linux-2.6.4/drivers/net/irda/ali-ircc.c Fri Mar 12 10:47:24 2004
> > @@ -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.
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
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] Patch to change char * into char[]
2004-03-12 16:44 [Kernel-janitors] Patch to change char * into char[] Peter McCurdy
2004-03-16 8:25 ` maximilian attems
2004-03-16 19:23 ` Domen Puncer
@ 2004-03-16 20:18 ` maximilian attems
2004-03-17 1:24 ` Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: maximilian attems @ 2004-03-16 20:18 UTC (permalink / raw)
To: kernel-janitors
On Tue, 16 Mar 2004, Domen Puncer wrote:
> On Tuesday 16 of March 2004 09:25, maximilian attems wrote:
> > hello peter,
> >
> > On Fri, 12 Mar 2004, Peter McCurdy wrote:
> > > diff -ruN linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c linux-2.6.4/drivers/net/irda/ali-ircc.c
> > > --- linux-2.6.4-kj-orig/drivers/net/irda/ali-ircc.c Fri Mar 12 10:15:01 2004
> > > +++ linux-2.6.4/drivers/net/irda/ali-ircc.c Fri Mar 12 10:47:24 2004
> > > @@ -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.
>
> 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.
> 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 <lcapitulino@prefeitura.sp.gov.br>
add/ string_form_drivers.patch
From: maximilian attems <janitor@sternwelten.at>
regards maks
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Kernel-janitors] Patch to change char * into char[]
2004-03-12 16:44 [Kernel-janitors] Patch to change char * into char[] Peter McCurdy
` (2 preceding siblings ...)
2004-03-16 20:18 ` maximilian attems
@ 2004-03-17 1:24 ` Domen Puncer
3 siblings, 0 replies; 5+ messages in thread
From: Domen Puncer @ 2004-03-17 1:24 UTC (permalink / raw)
To: kernel-janitors
On Tuesday 16 of March 2004 21:18, you wrote:
> On Tue, 16 Mar 2004, Domen Puncer wrote:
>
> > On Tuesday 16 of March 2004 09:25, maximilian attems wrote:
> > > 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.
> >
> > 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!!
Yeah, amazing.
> but the overall trend seems the same.
heh? mine shows improvements with the patch, yours regressions.
>
> > 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 :-)
> add/ keyboard_ptr_to_string.patch
> From: Luiz Fernando Capitulino <lcapitulino@prefeitura.sp.gov.br>
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
> add/ string_form_drivers.patch
> From: maximilian attems <janitor@sternwelten.at>
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
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-17 1:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-12 16:44 [Kernel-janitors] Patch to change char * into char[] Peter McCurdy
2004-03-16 8:25 ` maximilian attems
2004-03-16 19:23 ` Domen Puncer
2004-03-16 20:18 ` maximilian attems
2004-03-17 1:24 ` Domen Puncer
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.