Multi-character path separators

Patrick Doyle doylep at ecf.utoronto.ca
Sat May 13 20:44:34 PDT 2000



I noticed a "FIXME" in the Kaffe VM code which I think I have fixed.  It's
a trivial fix, really, but I suppose someone ought to do it.

The trouble is that this code assumes that the path separator is one
character long.  This patch simply uses "strstr" instead of "strchr" to
allow for longer path separators.

I have looked around at all the uses of path_separator, and it appears
that these are the only two references which need fixing.

Hope this is helpful.

--- /tmp/external.c	Sat May 13 08:43:35 2000
+++ kaffe/kaffevm/external.c	Sat May 13 08:43:52 2000
@@ -141,8 +141,7 @@
 
 	/* Find the default library */
 	for (ptr = libraryPath; ptr != 0; ptr = nptr) {
-		/* FIXME: requires path_separator to have length 1 */
-		nptr = strchr(ptr, path_separator[0]);
+		nptr = strstr(ptr, path_separator);
 		if (nptr == 0) {
 			strcpy(lib, ptr);
 		}
--- /tmp/findInJar.c	Sat May 13 08:44:18 2000
+++ kaffe/kaffevm/findInJar.c	Sat May 13 08:44:32 2000
@@ -321,8 +321,7 @@
 PDBG(	dprintf("initClasspath(): '%s'\n", cp);				)
 
 	for (;;) {
-		/* FIXME: requires path_separator to have length 1 */
-		end = strchr(cp, path_separator[0]);
+		end = strstr(cp, path_separator);
 		if (end != 0) {
 			*end = 0;
 			addClasspath(cp);

--
Patrick Doyle
doylep at ecf.toronto.edu




More information about the kaffe mailing list