2005-03-05 15:55:00

by Domen Puncer

[permalink] [raw]
Subject: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()


Replaces strtok() with strsep()

Signed-off-by: Nicolas Kaiser <[email protected]>
Signed-off-by: Domen Puncer <[email protected]>
---


kj-domen/scripts/mod/sumversion.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN scripts/mod/sumversion.c~strtok-scripts_mod_sumversion scripts/mod/sumversion.c
--- kj/scripts/mod/sumversion.c~strtok-scripts_mod_sumversion 2005-03-05 16:13:15.000000000 +0100
+++ kj-domen/scripts/mod/sumversion.c 2005-03-05 16:13:15.000000000 +0100
@@ -419,7 +419,9 @@ void get_src_version(const char *modname
*end = '\0';

md4_init(&md);
- for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
+ while ((fname = strsep(&sources, " ")) != NULL) {
+ if (!*fname)
+ continue;
if (!parse_source_files(fname, &md))
goto release;
}
_


2005-03-17 21:22:13

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()

On Sat, Mar 05, 2005 at 04:35:45PM +0100, [email protected] wrote:
>
> Replaces strtok() with strsep()

Why - does it increase portability?

Sam

2005-03-18 02:47:42

by Nicolas Kaiser

[permalink] [raw]
Subject: Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()

* Sam Ravnborg <[email protected]>:

> On Sat, Mar 05, 2005 at 04:35:45PM +0100, [email protected] wrote:
> >
> > Replaces strtok() with strsep()
>
> Why - does it increase portability?

"strtok() is not thread and SMP safe and strsep() should be
used instead"

http://janitor.kernelnewbies.org/docs/driver-howto.html#3.3.1

Cheers,
n.

2005-03-18 05:32:07

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()

On Fri, Mar 18, 2005 at 03:46:20AM +0100, Nicolas Kaiser wrote:
> * Sam Ravnborg <[email protected]>:
>
> > On Sat, Mar 05, 2005 at 04:35:45PM +0100, [email protected] wrote:
> > >
> > > Replaces strtok() with strsep()
> >
> > Why - does it increase portability?
>
> "strtok() is not thread and SMP safe and strsep() should be
> used instead"
>
> http://janitor.kernelnewbies.org/docs/driver-howto.html#3.3.1

It does not matter in this particular file.
But applied for consistency (so it does not show up if you grep for it).

Sam