public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()
@ 2005-03-05 15:35 domen
  2005-03-17 21:23 ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: domen @ 2005-03-05 15:35 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, domen, nikai


Replaces strtok() with strsep()
 
 Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 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;
 	}
_

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

* Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()
  2005-03-05 15:35 [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep() domen
@ 2005-03-17 21:23 ` Sam Ravnborg
  2005-03-18  2:46   ` Nicolas Kaiser
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2005-03-17 21:23 UTC (permalink / raw)
  To: domen; +Cc: akpm, linux-kernel, nikai

On Sat, Mar 05, 2005 at 04:35:45PM +0100, domen@coderock.org wrote:
> 
> Replaces strtok() with strsep()

Why - does it increase portability?

	Sam

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

* Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()
  2005-03-17 21:23 ` Sam Ravnborg
@ 2005-03-18  2:46   ` Nicolas Kaiser
  2005-03-18  5:33     ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Kaiser @ 2005-03-18  2:46 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: akpm, linux-kernel, domen

* Sam Ravnborg <sam@ravnborg.org>:

> On Sat, Mar 05, 2005 at 04:35:45PM +0100, domen@coderock.org 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.

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

* Re: [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep()
  2005-03-18  2:46   ` Nicolas Kaiser
@ 2005-03-18  5:33     ` Sam Ravnborg
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2005-03-18  5:33 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: akpm, linux-kernel, domen

On Fri, Mar 18, 2005 at 03:46:20AM +0100, Nicolas Kaiser wrote:
> * Sam Ravnborg <sam@ravnborg.org>:
> 
> > On Sat, Mar 05, 2005 at 04:35:45PM +0100, domen@coderock.org 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

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

end of thread, other threads:[~2005-03-18  5:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-05 15:35 [patch 12/12] scripts/mod/sumversion.c: replace strtok() with strsep() domen
2005-03-17 21:23 ` Sam Ravnborg
2005-03-18  2:46   ` Nicolas Kaiser
2005-03-18  5:33     ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox