ruby-changes:15052
From: nobu <ko1@a...>
Date: Mon, 15 Mar 2010 07:33:21 +0900 (JST)
Subject: [ruby-changes:15052] Ruby:r26928 (trunk): * file.c (file_alt_separator): commit miss.
nobu 2010-03-15 07:33:09 +0900 (Mon, 15 Mar 2010) New Revision: 26928 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26928 Log: * file.c (file_alt_separator): commit miss. Modified files: trunk/file.c Index: file.c =================================================================== --- file.c (revision 26927) +++ file.c (revision 26928) @@ -2495,6 +2495,7 @@ #endif #ifdef FILE_ALT_SEPARATOR #define isdirsep(x) ((x) == '/' || (x) == FILE_ALT_SEPARATOR) +static const char file_alt_separator[] = {FILE_ALT_SEPARATOR, '\0'}; #else #define isdirsep(x) ((x) == '/') #endif @@ -3174,9 +3175,9 @@ volatile VALUE unresolved_path; VALUE loopcheck; volatile VALUE curdir = Qnil; - + char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL; - char *ptr; + char *ptr, *prefixptr = NULL; rb_secure(2); @@ -3210,11 +3211,21 @@ resolved = rb_str_new(ptr, curdir_names - ptr); root_found: - ptr = chompdirsep(RSTRING_PTR(resolved)); + prefixptr = RSTRING_PTR(resolved); + prefixlen = RSTRING_LEN(resolved); + ptr = chompdirsep(prefixptr); if (*ptr) { - rb_str_set_len(resolved, ptr - RSTRING_PTR(resolved) + 1); + prefixlen = ++ptr - prefixptr; + rb_str_set_len(resolved, prefixlen); } - prefixlen = RSTRING_LEN(resolved); +#ifdef FILE_ALT_SEPARATOR + while (prefixptr < ptr) { + if (*prefixptr == FILE_ALT_SEPARATOR) { + *prefixptr = '/'; + } + prefixptr = CharNext(prefixptr); + } +#endif loopcheck = rb_hash_new(); if (curdir_names) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/