io.c: simplified pipe_del_fptr
* io.c (pipe_del_fptr): merged code for the case fptr is first to the loop for the rest. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e97cc46460
commit
80d74ea732
17
io.c
17
io.c
@ -6150,23 +6150,16 @@ pipe_add_fptr(rb_io_t *fptr)
|
|||||||
static void
|
static void
|
||||||
pipe_del_fptr(rb_io_t *fptr)
|
pipe_del_fptr(rb_io_t *fptr)
|
||||||
{
|
{
|
||||||
struct pipe_list *list = pipe_list;
|
struct pipe_list **prev = &pipe_list;
|
||||||
struct pipe_list *tmp;
|
struct pipe_list *tmp;
|
||||||
|
|
||||||
if (list->fptr == fptr) {
|
while ((tmp = *prev) != 0) {
|
||||||
pipe_list = list->next;
|
if (tmp->fptr == fptr) {
|
||||||
free(list);
|
*prev = tmp->next;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (list->next) {
|
|
||||||
if (list->next->fptr == fptr) {
|
|
||||||
tmp = list->next;
|
|
||||||
list->next = list->next->next;
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list = list->next;
|
prev = &tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user