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;
}
_
On Sat, Mar 05, 2005 at 04:35:45PM +0100, [email protected] wrote:
>
> Replaces strtok() with strsep()
Why - does it increase portability?
Sam
* 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.
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