* file.c (rb_stat_inspect): protoized function pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ca829d5926
commit
c59306cccb
@ -1,8 +1,10 @@
|
|||||||
Tue Sep 20 21:26:23 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Sep 20 22:25:43 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/io/wait/lib/nonblock.rb: disable on platforms non-blocking flag
|
* ext/io/wait/lib/nonblock.rb: disable on platforms non-blocking flag
|
||||||
is not available. fixed: [ruby-dev:27187]
|
is not available. fixed: [ruby-dev:27187]
|
||||||
|
|
||||||
|
* file.c (rb_stat_inspect): protoized function pointer.
|
||||||
|
|
||||||
Tue Sep 20 18:23:04 2005 Tanaka Akira <akr@m17n.org>
|
Tue Sep 20 18:23:04 2005 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* eval.c (thread_mark): mark th->last_status. [ruby-dev:27179]
|
* eval.c (thread_mark): mark th->last_status. [ruby-dev:27179]
|
||||||
|
76
file.c
76
file.c
@ -543,22 +543,22 @@ rb_stat_inspect(VALUE self)
|
|||||||
VALUE str;
|
VALUE str;
|
||||||
int i;
|
int i;
|
||||||
static struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
VALUE (*func)();
|
VALUE (*func)(VALUE);
|
||||||
} member[] = {
|
} member[] = {
|
||||||
{"dev", rb_stat_dev},
|
{"dev", rb_stat_dev},
|
||||||
{"ino", rb_stat_ino},
|
{"ino", rb_stat_ino},
|
||||||
{"mode", rb_stat_mode},
|
{"mode", rb_stat_mode},
|
||||||
{"nlink", rb_stat_nlink},
|
{"nlink", rb_stat_nlink},
|
||||||
{"uid", rb_stat_uid},
|
{"uid", rb_stat_uid},
|
||||||
{"gid", rb_stat_gid},
|
{"gid", rb_stat_gid},
|
||||||
{"rdev", rb_stat_rdev},
|
{"rdev", rb_stat_rdev},
|
||||||
{"size", rb_stat_size},
|
{"size", rb_stat_size},
|
||||||
{"blksize", rb_stat_blksize},
|
{"blksize", rb_stat_blksize},
|
||||||
{"blocks", rb_stat_blocks},
|
{"blocks", rb_stat_blocks},
|
||||||
{"atime", rb_stat_atime},
|
{"atime", rb_stat_atime},
|
||||||
{"mtime", rb_stat_mtime},
|
{"mtime", rb_stat_mtime},
|
||||||
{"ctime", rb_stat_ctime},
|
{"ctime", rb_stat_ctime},
|
||||||
};
|
};
|
||||||
|
|
||||||
str = rb_str_buf_new2("#<");
|
str = rb_str_buf_new2("#<");
|
||||||
@ -2647,12 +2647,12 @@ rb_file_s_extname(VALUE klass, VALUE fname)
|
|||||||
else
|
else
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
e = strrchr(p, '.'); /* get the last dot of the last component */
|
e = strrchr(p, '.'); /* get the last dot of the last component */
|
||||||
if (!e || e == p || !e[1]) /* no dot, or the only dot is first or end? */
|
if (!e || e == p || !e[1]) /* no dot, or the only dot is first or end? */
|
||||||
return rb_str_new2("");
|
return rb_str_new2("");
|
||||||
extname = rb_str_new(e, chompdirsep(e) - e); /* keep the dot, too! */
|
extname = rb_str_new(e, chompdirsep(e) - e); /* keep the dot, too! */
|
||||||
OBJ_INFECT(extname, fname);
|
OBJ_INFECT(extname, fname);
|
||||||
return extname;
|
return extname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2886,23 +2886,23 @@ static int
|
|||||||
rb_thread_flock(int fd, int op, OpenFile *fptr)
|
rb_thread_flock(int fd, int op, OpenFile *fptr)
|
||||||
{
|
{
|
||||||
if (rb_thread_alone() || (op & LOCK_NB)) {
|
if (rb_thread_alone() || (op & LOCK_NB)) {
|
||||||
int ret;
|
int ret;
|
||||||
TRAP_BEG;
|
TRAP_BEG;
|
||||||
ret = flock(fd, op);
|
ret = flock(fd, op);
|
||||||
TRAP_END;
|
TRAP_END;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
op |= LOCK_NB;
|
op |= LOCK_NB;
|
||||||
while (flock(fd, op) < 0) {
|
while (flock(fd, op) < 0) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
case EACCES:
|
case EACCES:
|
||||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
#endif
|
#endif
|
||||||
rb_thread_polling(); /* busy wait */
|
rb_thread_polling(); /* busy wait */
|
||||||
rb_io_check_closed(fptr);
|
rb_io_check_closed(fptr);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2953,23 +2953,23 @@ rb_file_flock(VALUE obj, VALUE operation)
|
|||||||
GetOpenFile(obj, fptr);
|
GetOpenFile(obj, fptr);
|
||||||
|
|
||||||
if (fptr->mode & FMODE_WRITABLE) {
|
if (fptr->mode & FMODE_WRITABLE) {
|
||||||
rb_io_flush(obj);
|
rb_io_flush(obj);
|
||||||
}
|
}
|
||||||
retry:
|
retry:
|
||||||
if (flock(fptr->fd, op) < 0) {
|
if (flock(fptr->fd, op) < 0) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
case EACCES:
|
case EACCES:
|
||||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
#endif
|
#endif
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
case EINTR:
|
case EINTR:
|
||||||
#if defined(ERESTART)
|
#if defined(ERESTART)
|
||||||
case ERESTART:
|
case ERESTART:
|
||||||
#endif
|
#endif
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
rb_sys_fail(fptr->path);
|
rb_sys_fail(fptr->path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2990,7 +2990,7 @@ test_check(int n, int argc, VALUE *argv)
|
|||||||
case T_STRING:
|
case T_STRING:
|
||||||
default:
|
default:
|
||||||
FilePathValue(argv[i]);
|
FilePathValue(argv[i]);
|
||||||
break;
|
break;
|
||||||
case T_FILE:
|
case T_FILE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3172,7 +3172,7 @@ rb_f_test(int argc, VALUE *argv)
|
|||||||
case '-':
|
case '-':
|
||||||
if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
|
if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
|
|
||||||
case '=':
|
case '=':
|
||||||
if (st1.st_mtime == st2.st_mtime) return Qtrue;
|
if (st1.st_mtime == st2.st_mtime) return Qtrue;
|
||||||
@ -3185,7 +3185,7 @@ rb_f_test(int argc, VALUE *argv)
|
|||||||
case '<':
|
case '<':
|
||||||
if (st1.st_mtime < st2.st_mtime) return Qtrue;
|
if (st1.st_mtime < st2.st_mtime) return Qtrue;
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* unknown command */
|
/* unknown command */
|
||||||
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
|
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
|
||||||
@ -4062,7 +4062,7 @@ rb_find_file(VALUE path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
define_filetest_function(const char *name, VALUE (*func) (/* ??? */), int argc)
|
define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc)
|
||||||
{
|
{
|
||||||
rb_define_module_function(rb_mFileTest, name, func, argc);
|
rb_define_module_function(rb_mFileTest, name, func, argc);
|
||||||
rb_define_singleton_method(rb_cFile, name, func, argc);
|
rb_define_singleton_method(rb_cFile, name, func, argc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user