int remove_user_keys(const wchar_t *keys, int mode) { key_chunk_t *curr, *p; if((curr = find_user_keys(keys, mode)) == NULL) return -1; free(curr->conf.data.cmd); curr->conf.type = BUILTIN_WAIT_POINT; curr->conf.data.handler = NULL; p = curr; while(p->parent != NULL) { p->parent->children_count--; p = p->parent; } if(curr->children_count > 0) return 0; do { key_chunk_t *const parent = curr->parent; if(curr->prev != NULL) curr->prev->next = curr->next; else parent->child = curr->next; if(curr->next != NULL) curr->next->prev = curr->prev; free_chunk(curr); curr = parent; } while(curr->parent != NULL && curr->parent->conf.data.handler == NULL && curr->parent->conf.type == BUILTIN_WAIT_POINT && curr->parent->children_count == 0); return 0; }
int has_user_keys(const wchar_t *keys, int mode) { return find_user_keys(keys, mode) != NULL; }
int vle_keys_user_exists(const wchar_t keys[], int mode) { return find_user_keys(keys, mode) != NULL; }