void keyword_alloc_sub(vector_t *keywords_vec, char *string, void (*handler) (vector_t *)) { int i = 0; keyword_t *keyword; /* fetch last keyword */ keyword = vector_slot(keywords_vec, vector_size(keywords_vec) - 1); /* position to last sub level */ for (i = 0; i < sublevel; i++) keyword = vector_slot(keyword->sub, vector_size(keyword->sub) - 1); /* First sub level allocation */ if (!keyword->sub) keyword->sub = vector_alloc(); /* add new sub keyword */ keyword_alloc(keyword->sub, string, handler); }
static void keyword_alloc_sub(vector_t *keywords_vec, const char *string, void (*handler) (vector_t *)) { int i = 0; keyword_t *keyword; /* fetch last keyword */ keyword = vector_slot(keywords_vec, vector_size(keywords_vec) - 1); /* Don't install subordinate keywords if configuration block inactive */ if (!keyword->active) return; /* position to last sub level */ for (i = 0; i < sublevel; i++) keyword = vector_slot(keyword->sub, vector_size(keyword->sub) - 1); /* First sub level allocation */ if (!keyword->sub) keyword->sub = vector_alloc(); /* add new sub keyword */ keyword_alloc(keyword->sub, string, handler, true); }
void install_keyword_root(const char *string, void (*handler) (vector_t *), bool active) { keyword_alloc(keywords, string, handler, active); }
void install_keyword_root(char *string, void (*handler) (vector_t *)) { keyword_alloc(keywords, string, handler); }