* dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-03-16 08:30:09 +00:00
Родитель 7f74a38b72
Коммит b842d5f571
7 изменённых файлов: 53 добавлений и 23 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016).
Fri Mar 16 17:14:17 2001 Akinori MUSHA <knu@iDaemons.org>
* configure.in: Set SOLIBS properly for all ELF and

5
README
Просмотреть файл

@ -120,9 +120,8 @@ You can redistribute it and/or modify it under either the terms of the GPL
software (possibly commercial). But some files in the distribution
are not written by the author, so that they are not under this terms.
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
files under the ./missing directory. See each file for the copying
condition.
They are utils.c(partly), regex.[ch], st.[ch] and some files under
the ./missing directory. See each file for the copying condition.
5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the

Просмотреть файл

@ -178,10 +178,9 @@ Public License)
だし,本プログラムに含まれる他の作者によるコードは,そ
れぞれの作者の意向による制限が加えられる場合があります.
具体的にはgc.c(一部)util.c(一部)st.[ch]regex.[ch]
および ./missingディレクトリ下のファイル群が該当します
それぞれの配布条件などに付いては各ファイルを参照してく
ださい.
具体的にはutil.c(一部)st.[ch]regex.[ch] および
./missingディレクトリ下のファイル群が該当しますそれぞ
れの配布条件などに付いては各ファイルを参照してください.
5. 本プログラムへの入力となるスクリプトおよび,本プログラ
ムからの出力の権利は本プログラムの作者ではなく,それぞ

49
dir.c
Просмотреть файл

@ -389,13 +389,38 @@ dir_close(dir)
return Qnil;
}
static void
dir_chdir(path)
const char *path;
{
if (chdir(path) < 0)
rb_sys_fail(path);
}
static int chdir_blocking = 0;
static VALUE
chdir_restore(path)
const char *path;
{
chdir_blocking--;
dir_chdir(path);
return Qnil;
}
#ifdef HAVE_GETCWD
#define GETCWD(path) if (getcwd(path, sizeof(path)) == 0) rb_sys_fail(path)
#else
#define GETCWD(path) if (getwd(path) == 0) rb_sys_fail(path)
#endif
static VALUE
dir_s_chdir(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
VALUE path;
VALUE path = Qnil;
char *dist = "";
rb_secure(2);
@ -410,8 +435,18 @@ dir_s_chdir(argc, argv, obj)
}
}
if (chdir(dist) < 0)
rb_sys_fail(dist);
if (chdir_blocking > 0)
rb_warn("chdir during chdir block");
if (rb_block_given_p()) {
char cwd[MAXPATHLEN];
GETCWD(cwd);
chdir_blocking++;
dir_chdir(dist);
return rb_ensure(rb_yield, path, chdir_restore, (VALUE)cwd);
}
dir_chdir(dist);
return INT2FIX(0);
}
@ -422,13 +457,7 @@ dir_s_getwd(dir)
{
char path[MAXPATHLEN];
#ifdef HAVE_GETCWD
if (getcwd(path, sizeof(path)) == 0) rb_sys_fail(path);
#else
extern char *getwd();
if (getwd(path) == 0) rb_sys_fail(path);
#endif
GETCWD(path);
return rb_tainted_str_new2(path);
}

3
eval.c
Просмотреть файл

@ -775,7 +775,6 @@ static struct tag *prot_tag;
_tag.frame = ruby_frame; \
_tag.iter = ruby_iter; \
_tag.prev = prot_tag; \
_tag.retval = Qnil; \
_tag.scope = ruby_scope; \
_tag.tag = ptag; \
_tag.dst = 0; \
@ -6332,7 +6331,7 @@ proc_eq(self, other)
struct BLOCK *data, *data2;
if (TYPE(other) != T_DATA) return Qfalse;
if (RDATA(other)->dmark != blk_mark) Qfalse;
if (RDATA(other)->dmark != (RUBY_DATA_FUNC)blk_mark) Qfalse;
Data_Get_Struct(self, struct BLOCK, data);
Data_Get_Struct(other, struct BLOCK, data2);
if (data->tag == data2->tag) return Qtrue;

Просмотреть файл

@ -182,8 +182,8 @@ char *rb_find_file _((char*));
void rb_gc_mark_locations _((VALUE*, VALUE*));
void rb_mark_tbl _((struct st_table*));
void rb_mark_hash _((struct st_table*));
void rb_gc_mark_maybe();
void rb_gc_mark();
void rb_gc_mark_maybe _((void*));
void rb_gc_mark _((void*));
void rb_gc_force_recycle _((VALUE));
void rb_gc _((void));
void rb_gc_call_finalizer_at_exit _((void));

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.0"
#define RUBY_RELEASE_DATE "2001-03-14"
#define RUBY_RELEASE_DATE "2001-03-16"
#define RUBY_VERSION_CODE 170
#define RUBY_RELEASE_CODE 20010314
#define RUBY_RELEASE_CODE 20010316