From 12b5b81a975e2190aebe762b10ceadccd439a45a Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 15 Dec 2003 04:07:03 +0000 Subject: * dir.c (check_dirname): check string safety and remove extraneous trailing directory separators. [ruby-dev:22279] * file.c: extern rb_path_next, rb_path_skip_prefix, rb_path_last_separator, rb_path_end. * intern.h: prototypes for rb_path_next, rb_path_skip_prefix, rb_path_last_separator, rb_path_end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index cfa52e76bd..f338db646d 100644 --- a/file.c +++ b/file.c @@ -1459,7 +1459,8 @@ skiproot(path) return (char *)path; } -static inline char * +#define nextdirsep rb_path_next +char * nextdirsep(s) const char *s; { @@ -1469,11 +1470,12 @@ nextdirsep(s) return (char *)s; } -#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) -static inline char * +#define skipprefix rb_path_skip_prefix +char * skipprefix(path) const char *path; { +#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) #ifdef DOSISH_UNC if (isdirsep(path[0]) && isdirsep(path[1])) { if (*(path = nextdirsep(path + 2))) @@ -1484,14 +1486,13 @@ skipprefix(path) #ifdef DOSISH_DRIVE_LETTER if (has_drive_letter(path)) return (char *)(path + 2); +#endif #endif return (char *)path; } -#else -#define skipprefix(path) (path) -#endif -static char * +#define strrdirsep rb_path_last_separator +char * strrdirsep(path) const char *path; { @@ -1510,7 +1511,8 @@ strrdirsep(path) return last; } -static char * +#define chompdirsep rb_path_end +char * chompdirsep(path) const char *path; { -- cgit v1.2.3