summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 13:39:58 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 13:39:58 +0000
commitba2b829a0f154624b1b315b98de01274343b4336 (patch)
treed9eefc582818ea1c43b35371516342cc0b9790d0 /win32
parentb617f5270c610bf870e7267f9db3d32f93551611 (diff)
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 05b971c..1311b7e 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -873,19 +873,18 @@ NtCmdGlob (NtCmdLineElement *patt)
{
ListInfo listinfo;
char buffer[MAXPATHLEN], *buf = buffer;
- char *p, *pend, *pb;
+ char *p;
listinfo.head = listinfo.tail = 0;
if (patt->len >= MAXPATHLEN)
buf = ruby_xmalloc(patt->len + 1);
- p = patt->str;
- pend = p + patt->len;
- pb = buf;
- for (; p < pend; p = CharNext(p))
- *pb++ = *p == '\\' ? '/' : *p;
- buf[patt->len] = 0;
+ strncpy (buf, patt->str, patt->len);
+ buf[patt->len] = '\0';
+ for (p = buf; *p; p = CharNext(p))
+ if (*p == '\\')
+ *p = '/';
rb_glob(buf, insert, (VALUE)&listinfo);
if (buf != buffer)
free(buf);