LIST_HEAD as a local variable is a C99ism.
Address of a variable whose storage duration is `auto` is _not_ a compile time constant, according to ISO 9899 section 6.4. LIST_HEAD takes such thing. You can't use it to declare local variables. Interestingly, address of a static variable _is_ a compile time constant. So a declaration like `static LIST_HEAD..` is completely legal even in C90. In C99 and newer, this is not a constraint violation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
766ee6e550
commit
496ddbc275
3
io.c
3
io.c
@ -4670,7 +4670,8 @@ io_close_fptr(VALUE io)
|
|||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
VALUE write_io;
|
VALUE write_io;
|
||||||
rb_io_t *write_fptr;
|
rb_io_t *write_fptr;
|
||||||
LIST_HEAD(busy);
|
struct list_head busy;
|
||||||
|
busy.n.next = busy.n.prev = &busy.n;
|
||||||
|
|
||||||
write_io = GetWriteIO(io);
|
write_io = GetWriteIO(io);
|
||||||
if (io != write_io) {
|
if (io != write_io) {
|
||||||
|
3
thread.c
3
thread.c
@ -2288,7 +2288,8 @@ rb_notify_fd_close(int fd, struct list_head *busy)
|
|||||||
void
|
void
|
||||||
rb_thread_fd_close(int fd)
|
rb_thread_fd_close(int fd)
|
||||||
{
|
{
|
||||||
LIST_HEAD(busy);
|
struct list_head busy;
|
||||||
|
busy.n.next = busy.n.prev = &busy.n;
|
||||||
|
|
||||||
if (rb_notify_fd_close(fd, &busy)) {
|
if (rb_notify_fd_close(fd, &busy)) {
|
||||||
do rb_thread_schedule(); while (!list_empty(&busy));
|
do rb_thread_schedule(); while (!list_empty(&busy));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user