Skip to contentSkip to conversation

scripts/mod/sumversion.c: replace strtok() with

PATCH New Nicolas Kaiser 1 participant 1 message Feb 8, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/mod/sumversion.c: replace strtok() with

Hi there,

I just read about the strtok() replacement at
http://janitor.kernelnewbies.org/docs/driver-howto.html#3.3.1
and found one occurrence. He, the example code gives me a warning about a missing pair of brackets :)
Patch below compiles without warning, runs without problems.

Did I miss anything?

Cheers,
n.

Description: Replaces strtok() with strsep()

mod/sumversion.c renamed from mod/sumversion.c.orig +3 -1
@@ -419,7 +419,9 @@
 	*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;
 	}

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors