void exchange_katcl(struct katcl_line *l, int fd) { sane_line_katcl(l); /* WARNING: exchanging fds forces discarding of pending io */ if(l->l_fd >= 0){ close(l->l_fd); } l->l_fd = fd; if(l->l_ready){ destroy_parse_katcl(l->l_ready); l->l_ready = NULL; } if(l->l_next){ l->l_next = reuse_parse_katcl(l->l_next); } if(l->l_stage){ destroy_parse_katcl(l->l_stage); l->l_stage = NULL; } l->l_pending = 0; l->l_arg = 0; l->l_offset = 0; clear_queue_katcl(l->l_queue); l->l_error = 0; l->l_sendable = 1; }
void discard_katcl(struct katcl_line *l) { sane_line_katcl(l); if(l->l_next){ l->l_next = reuse_parse_katcl(l->l_next); } }