This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Tom Tromey writes:
 > >>>>> "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.

I don't understand why we can't just normalize the whole string before
scanning it.  We don't want more than one directory separator.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]