summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-15 04:07:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-15 04:07:03 +0000
commit12b5b81a975e2190aebe762b10ceadccd439a45a (patch)
treeea0be062c65349f4d081339c91de43858a06e73e /file.c
parent8e434982228dde94ced3e95a5ac1904cd2391441 (diff)
* 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
Diffstat (limited to 'file.c')
-rw-r--r--file.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/file.c b/file.c
index cfa52e7..f338db6 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)))
@@ -1485,13 +1487,12 @@ skipprefix(path)
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;
{