For Review: Sanitise Use of DIR_SEPARATOR in the Front-End

Tom Tromey tromey@redhat.com
Tue Jan 28 21:42:00 GMT 2003


>>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:

Ranjit> If any of this looks pathetic to you, do be nice enough to point
Ranjit> out a better way of achieving the same. (The strcasecmp( ) thing
Ranjit> makes the code look ugly - perhaps we can use a function pointer
Ranjit> there?)
You could just have a new function-style define:
 #ifdef ...
 #define COMPARE_FILENAMES(..) strcasecmp(..)
 ...
I'd prefer that to having more #ifs in the body of the code.
Maybe there is already such a define somewhere.
Ranjit> In addition, I found a small issue with assuming a
Ranjit> case-sensitive filesystem while scanning the classpath for ZIP
Ranjit> or JAR files, and have included the fix for the same.
What part of the patch is it? If it is independent it should go in as
a separate fix.
Ranjit> /* Get the name of the directory. */
Ranjit> sep = strrchr (filename, DIR_SEPARATOR);
Ranjit> +#ifdef DIR_SEPARATOR_2
Ranjit> + if (! sep)
Ranjit> + sep = strrchr (filename, DIR_SEPARATOR_2);
Ranjit> +#endif
Code like this should be rewritten. This isn't reliable if a path
contains both `\' and `/'. I don't know if that is a valid situation.
libiberty must have a directory-name-finding function...? That way
"someone else" can worry about the details.
Overall this is looking good.
Have you looked at making libgcj build on a case-insensitive file
system? That failure is a longstanding complaint of Windows users.
Tom


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /