void cmd_shift(struct command *c) { if (ilist_len(c->parse) > 1) { /* * Deleted argument need not be freed, since it's just a * pointer into another string. It was never allocated * itself. */ ilist_delete((ilist *) & c->parse, 1); } c->a = c->b; c->b = c->c; c->c = c->d; c->d = c->e; c->e = c->f; c->f = c->g; c->g = c->h; if (numargs(c) >= 8) c->h = parse_arg(c->who, c->parse[8]); else c->h = 0; }
static void start_next_op(opq_t *opq) { ilist_iter_t iter; opq_elem_t *elem; int success; ilist_init_iter(&iter, opq->ops); ilist_first(&iter); elem = ilist_get(&iter); while (elem) { ilist_delete(&iter); opq->done_handler = elem->done; opq->done_data = elem->done_data; opq_unlock(opq); success = elem->handler(elem->handler_data, 0); opq_free_elem(elem); opq_lock(opq); if (success == OPQ_HANDLER_STARTED) break; ilist_first(&iter); elem = ilist_get(&iter); } if (!elem) opq->in_handler = 0; }
static void opq_destroy_item(ilist_iter_t *iter, void *item, void *cb_data) { opq_elem_t *elem = (opq_elem_t *) item; elem->handler(elem->handler_data, 1); /* Memory for this is in elem, so we must delete it before we free the elem. */ ilist_delete(iter); opq_free_elem(elem); }
int keypad_unbind_key(keypad_t keypad, int key) { ilist_iter_t iter; struct key_entry *entry; entry = find_key(&iter, keypad, key); if (!entry) return ENOENT; ilist_delete(&iter); ipmi_mem_free(entry); return 0; }
void opq_op_done(opq_t *opq) { ilist_iter_t iter; opq_elem_t *elem; opq_elem_t *list = NULL; opq_elem_t *next; opq_elem_t **list_end = &list; opq_done_cb done_handler; void *done_data; /* First check for done handlers. */ opq_lock(opq); ilist_init_iter(&iter, opq->ops); ilist_first(&iter); elem = ilist_get(&iter); while (elem && (!elem->block)) { ilist_delete(&iter); elem->next = NULL; *list_end = elem; list_end = &(elem->next); elem = ilist_get(&iter); } done_handler = opq->done_handler; done_data = opq->done_data; opq->done_handler = NULL; if (done_handler || list) { /* There are done handlers to call, unlock and call them. */ opq_unlock(opq); if (done_handler) done_handler(done_data, 0); while (list) { next = list->next; list->done(list->done_data, 0); opq_free_elem(list); list = next; } opq_lock(opq); /* During the time we were unlocked, handlers may have been added. */ ilist_first(&iter); elem = ilist_get(&iter); } start_next_op(opq); opq_unlock(opq); }
static void del_key_entry(ilist_iter_t *iter, void *item, void *cb_data) { ilist_delete(iter); ipmi_mem_free(item); }