summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-18 09:52:48 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-18 09:52:48 +0000
commit7de72c4858a8240ae025aecb3599291f0bf90e34 (patch)
tree441e714bdb81d7dc466279d4b7306158a5043a7f /dir.c
parent3432cecf246414d63d55e70aeb5697e62198618f (diff)
* parse.y (expr_value, arg_value, primary_value): value_expr()
check in place. * eval.c (block_pass): "&nil" should clear block given. * dir.c (push_braces): remove MAXPATHLEN dependency. * dir.c (dir_s_globd): ditto. * dln.c (init_funcname): ditto. * dln.c (load_1): ditto. * dln.c (dln_load): ditto. * configure.in: add GNU/Hurd switches. * pack.c (pack_pack): allows comment in template strings. * pack.c (pack_unpack): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/dir.c b/dir.c
index 13176f4cc5..b56198633e 100644
--- a/dir.c
+++ b/dir.c
@@ -841,7 +841,7 @@ push_braces(ary, s)
VALUE ary;
char *s;
{
- char buffer[MAXPATHLEN], *buf = buffer;
+ char *buf;
char *p, *t, *b;
char *lbrace, *rbrace;
int nest = 0;
@@ -866,8 +866,7 @@ push_braces(ary, s)
if (lbrace) {
int len = strlen(s);
- if (len >= MAXPATHLEN)
- buf = xmalloc(len + 1);
+ buf = xmalloc(len + 1);
memcpy(buf, s, lbrace-s);
b = buf + (lbrace-s);
p = lbrace;
@@ -881,8 +880,7 @@ push_braces(ary, s)
strcpy(b+(p-t), rbrace+1);
push_braces(ary, buf);
}
- if (buf != buffer)
- free(buf);
+ free(buf);
}
else {
push_globs(ary, s);
@@ -896,7 +894,7 @@ dir_s_glob(dir, str)
VALUE dir, str;
{
char *p, *pend;
- char buffer[MAXPATHLEN], *buf;
+ char *buf;
char *t;
int nest;
VALUE ary = 0;
@@ -905,11 +903,7 @@ dir_s_glob(dir, str)
if (!rb_block_given_p()) {
ary = rb_ary_new();
}
- if (RSTRING(str)->len >= MAXPATHLEN) {
- buf = xmalloc(RSTRING(str)->len + 1);
- } else {
- buf = buffer;
- }
+ buf = xmalloc(RSTRING(str)->len + 1);
p = RSTRING(str)->ptr;
pend = p + RSTRING(str)->len;
@@ -936,8 +930,7 @@ dir_s_glob(dir, str)
}
/* else unmatched braces */
}
- if (buf != buffer)
- free(buf);
+ free(buf);
if (ary) {
return ary;
}