From: Arran Cudbard-Bell Date: Wed, 31 Dec 2014 15:15:12 +0000 (-0500) Subject: rename cf_itemto* X-Git-Tag: release_3_0_7~388 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9855526a6144ffad1014862a3c7efc3e010a6b39;p=thirdparty%2Ffreeradius-server.git rename cf_itemto* --- diff --git a/src/include/conffile.h b/src/include/conffile.h index 6d236ce7d6b..7548cf4e5e5 100644 --- a/src/include/conffile.h +++ b/src/include/conffile.h @@ -209,10 +209,10 @@ int cf_pair_count(CONF_SECTION const *cs); CONF_SECTION *cf_item_parent(CONF_ITEM const *ci); bool cf_item_is_section(CONF_ITEM const *item); bool cf_item_is_pair(CONF_ITEM const *item); -CONF_PAIR *cf_itemtopair(CONF_ITEM const *item); -CONF_SECTION *cf_itemtosection(CONF_ITEM const *item); -CONF_ITEM *cf_pairtoitem(CONF_PAIR const *cp); -CONF_ITEM *cf_sectiontoitem(CONF_SECTION const *cs); +CONF_PAIR *cf_item_to_pair(CONF_ITEM const *item); +CONF_SECTION *cf_item_to_section(CONF_ITEM const *item); +CONF_ITEM *cf_pair_to_item(CONF_PAIR const *cp); +CONF_ITEM *cf_section_to_item(CONF_SECTION const *cs); void cf_log_err(CONF_ITEM const *ci, char const *fmt, ...) CC_HINT(format (printf, 2, 3)); void cf_log_err_cs(CONF_SECTION const *cs, char const *fmt, ...) CC_HINT(format (printf, 2, 3)); diff --git a/src/main/client.c b/src/main/client.c index 142fc5624a7..7bacfc950a3 100644 --- a/src/main/client.c +++ b/src/main/client.c @@ -1246,7 +1246,7 @@ RADCLIENT *client_afrom_request(RADCLIENT_LIST *clients, REQUEST *request) RDEBUG2("%s = '%s'", vp->da->name, value); cp = cf_pair_alloc(c->cs, vp->da->name, value, T_OP_SET, T_SINGLE_QUOTED_STRING); - ci = cf_pairtoitem(cp); + ci = cf_pair_to_item(cp); cf_item_add(c->cs, ci); talloc_free(vp); diff --git a/src/main/command.c b/src/main/command.c index 6847c197641..c9e22dd7d7c 100644 --- a/src/main/command.c +++ b/src/main/command.c @@ -375,7 +375,7 @@ static int command_show_config(rad_listen_t *listener, int argc, char *argv[]) if (!cf_item_is_pair(ci)) return 0; - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); value = cf_pair_value(cp); if (!value) return 0; diff --git a/src/main/conffile.c b/src/main/conffile.c index 5f92e0dff56..454c88e93bf 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -136,7 +136,7 @@ static CONF_SECTION *cf_template_copy(CONF_SECTION *parent, CONF_SECTION const * /** Cast a CONF_ITEM to a CONF_PAIR * */ -CONF_PAIR *cf_itemtopair(CONF_ITEM const *ci) +CONF_PAIR *cf_item_to_pair(CONF_ITEM const *ci) { CONF_PAIR *out; @@ -151,7 +151,7 @@ CONF_PAIR *cf_itemtopair(CONF_ITEM const *ci) /** Cast a CONF_ITEM to a CONF_SECTION * */ -CONF_SECTION *cf_itemtosection(CONF_ITEM const *ci) +CONF_SECTION *cf_item_to_section(CONF_ITEM const *ci) { CONF_SECTION *out; @@ -166,7 +166,7 @@ CONF_SECTION *cf_itemtosection(CONF_ITEM const *ci) /** Cast a CONF_PAIR to a CONF_ITEM * */ -CONF_ITEM *cf_pairtoitem(CONF_PAIR const *cp) +CONF_ITEM *cf_pair_to_item(CONF_PAIR const *cp) { CONF_ITEM *out; @@ -179,7 +179,7 @@ CONF_ITEM *cf_pairtoitem(CONF_PAIR const *cp) /** Cast a CONF_SECTION to a CONF_ITEM * */ -CONF_ITEM *cf_sectiontoitem(CONF_SECTION const *cs) +CONF_ITEM *cf_section_to_item(CONF_SECTION const *cs) { CONF_ITEM *out; @@ -192,7 +192,7 @@ CONF_ITEM *cf_sectiontoitem(CONF_SECTION const *cs) /** Cast CONF_DATA to a CONF_ITEM * */ -static CONF_ITEM *cf_datatoitem(CONF_DATA const *cd) +static CONF_ITEM *cf_data_to_item(CONF_DATA const *cd) { CONF_ITEM *out; @@ -363,7 +363,7 @@ CONF_PAIR *cf_pair_dup(CONF_SECTION *parent, CONF_PAIR *cp) */ void cf_pair_add(CONF_SECTION *parent, CONF_PAIR *cp) { - cf_item_add(parent, cf_pairtoitem(cp)); + cf_item_add(parent, cf_pair_to_item(cp)); } /** Allocate a CONF_SECTION @@ -459,7 +459,7 @@ CONF_SECTION *cf_section_dup(CONF_SECTION *parent, CONF_SECTION const *cs, char ci; ci = cf_item_find_next(cs, ci)) { if (cf_item_is_section(ci)) { - child = cf_itemtosection(ci); + child = cf_item_to_section(ci); child = cf_section_dup(new, child, cf_section_name1(child), cf_section_name2(child)); if (!child) { talloc_free(new); @@ -470,7 +470,7 @@ CONF_SECTION *cf_section_dup(CONF_SECTION *parent, CONF_SECTION const *cs, char } if (cf_item_is_pair(ci)) { - cp = cf_pair_dup(new, cf_itemtopair(ci)); + cp = cf_pair_dup(new, cf_item_to_pair(ci)); if (!cp) { talloc_free(new); return NULL; @@ -551,7 +551,7 @@ void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci) switch (ci->type) { case CONF_ITEM_PAIR: if (!rbtree_insert(cs->pair_tree, ci)) { - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); if (strcmp(cp->attr, "confdir") == 0) break; if (!cp->value) break; /* module name, "ok", etc. */ @@ -559,7 +559,7 @@ void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci) break; case CONF_ITEM_SECTION: { - CONF_SECTION *cs_new = cf_itemtosection(ci); + CONF_SECTION *cs_new = cf_item_to_section(ci); CONF_SECTION *name1_cs; if (!cs->section_tree) { @@ -666,7 +666,7 @@ CONF_ITEM *cf_reference_item(CONF_SECTION const *parentcs, * Just '.' means the current section */ if (*p == '\0') { - return cf_sectiontoitem(cs); + return cf_section_to_item(cs); } /* @@ -683,7 +683,7 @@ CONF_ITEM *cf_reference_item(CONF_SECTION const *parentcs, * enclosing this section */ if (!*++p) { - return cf_sectiontoitem(cs); + return cf_section_to_item(cs); } } @@ -866,7 +866,7 @@ static char const *cf_expand_variables(char const *cf, int *lineno, * it's the property of a section. */ if (q) { - CONF_SECTION *mycs = cf_itemtosection(ci); + CONF_SECTION *mycs = cf_item_to_section(ci); if (ci->type != CONF_ITEM_SECTION) { ERROR("%s[%d]: Can only reference properties of sections", cf, *lineno); @@ -893,7 +893,7 @@ static char const *cf_expand_variables(char const *cf, int *lineno, /* * Substitute the value of the variable. */ - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); if (!cp->value) { ERROR("%s[%d]: Reference \"%s\" has no value", cf, *lineno, input); @@ -927,7 +927,7 @@ static char const *cf_expand_variables(char const *cf, int *lineno, * Copy the section instead of * referencing it. */ - subcs = cf_template_copy(outercs, cf_itemtosection(ci)); + subcs = cf_template_copy(outercs, cf_item_to_section(ci)); if (!subcs) { ERROR("%s[%d]: Failed copying reference %s", cf, *lineno, name); return NULL; @@ -1597,7 +1597,7 @@ static CONF_SECTION *cf_template_copy(CONF_SECTION *parent, CONF_SECTION const * if (ci->type == CONF_ITEM_PAIR) { CONF_PAIR *cp1, *cp2; - cp1 = cf_itemtopair(ci); + cp1 = cf_item_to_pair(ci); cp2 = cf_pair_alloc(cs, cp1->attr, cp1->value, cp1->op, cp1->value_type); if (!cp2) return false; @@ -1611,7 +1611,7 @@ static CONF_SECTION *cf_template_copy(CONF_SECTION *parent, CONF_SECTION const * if (ci->type == CONF_ITEM_SECTION) { CONF_SECTION *subcs1, *subcs2; - subcs1 = cf_itemtosection(ci); + subcs1 = cf_item_to_section(ci); subcs2 = cf_template_copy(cs, subcs1); subcs2->item.filename = subcs1->item.filename; @@ -1651,7 +1651,7 @@ static bool cf_template_merge(CONF_SECTION *cs, CONF_SECTION const *template) /* * It exists, don't over-write it. */ - cp1 = cf_itemtopair(ci); + cp1 = cf_item_to_pair(ci); if (cf_pair_find(cs, cp1->attr)) { continue; } @@ -1673,7 +1673,7 @@ static bool cf_template_merge(CONF_SECTION *cs, CONF_SECTION const *template) if (ci->type == CONF_ITEM_SECTION) { CONF_SECTION *subcs1, *subcs2; - subcs1 = cf_itemtosection(ci); + subcs1 = cf_item_to_section(ci); rad_assert(subcs1 != NULL); subcs2 = cf_section_sub_find_name2(cs, subcs1->name1, subcs1->name2); @@ -2064,7 +2064,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp, return -1; } - this->template = cf_itemtosection(ci); + this->template = cf_item_to_section(ci); continue; } @@ -2101,7 +2101,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp, /* * Skip (...) to find the { */ - slen = fr_condition_tokenize(nextcs, cf_sectiontoitem(nextcs), ptr, &cond, + slen = fr_condition_tokenize(nextcs, cf_section_to_item(nextcs), ptr, &cond, &error, FR_COND_TWO_PASS); memcpy(&p, &ptr, sizeof(p)); @@ -2160,7 +2160,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp, nextcs->item.filename = talloc_strdup(nextcs, filename); nextcs->item.lineno = *lineno; - slen = fr_condition_tokenize(nextcs, cf_sectiontoitem(nextcs), ptr, &cond, + slen = fr_condition_tokenize(nextcs, cf_section_to_item(nextcs), ptr, &cond, &error, FR_COND_TWO_PASS); *p = '{'; /* put it back */ @@ -2719,15 +2719,15 @@ CONF_SECTION *cf_section_find_name2(CONF_SECTION const *cs, if (ci->type != CONF_ITEM_SECTION) continue; - if (strcmp(cf_itemtosection(ci)->name1, name1) != 0) { + if (strcmp(cf_item_to_section(ci)->name1, name1) != 0) { continue; } - their2 = cf_itemtosection(ci)->name2; + their2 = cf_item_to_section(ci)->name2; if ((!name2 && !their2) || (name2 && their2 && (strcmp(name2, their2) == 0))) { - return cf_itemtosection(ci); + return cf_item_to_section(ci); } } @@ -2765,10 +2765,10 @@ CONF_PAIR *cf_pair_find_next(CONF_SECTION const *cs, ci = ci->next) { if (ci->type != CONF_ITEM_PAIR) continue; - if (!attr || strcmp(cf_itemtopair(ci)->attr, attr) == 0) break; + if (!attr || strcmp(cf_item_to_pair(ci)->attr, attr) == 0) break; } - return cf_itemtopair(ci); + return cf_item_to_pair(ci); } /* @@ -2863,7 +2863,7 @@ CONF_SECTION *cf_section_sub_find_name2(CONF_SECTION const *cs, if (ci->type != CONF_ITEM_SECTION) continue; - subcs = cf_itemtosection(ci); + subcs = cf_item_to_section(ci); if (!subcs->name2) { if (strcmp(subcs->name1, name2) == 0) break; } else { @@ -2871,7 +2871,7 @@ CONF_SECTION *cf_section_sub_find_name2(CONF_SECTION const *cs, } } - return cf_itemtosection(ci); + return cf_item_to_section(ci); } /* @@ -2903,11 +2903,11 @@ CONF_SECTION *cf_subsection_find_next(CONF_SECTION const *section, if (ci->type != CONF_ITEM_SECTION) continue; if ((name1 == NULL) || - (strcmp(cf_itemtosection(ci)->name1, name1) == 0)) + (strcmp(cf_item_to_section(ci)->name1, name1) == 0)) break; } - return cf_itemtosection(ci); + return cf_item_to_section(ci); } @@ -2955,7 +2955,7 @@ static void _pair_count(int *count, CONF_SECTION const *cs) ci = cf_item_find_next(cs, ci)) { if (cf_item_is_section(ci)) { - _pair_count(count, cf_itemtosection(ci)); + _pair_count(count, cf_item_to_section(ci)); continue; } @@ -3091,7 +3091,7 @@ static int cf_data_add_internal(CONF_SECTION *cs, char const *name, if (!cd) return -1; cd->flag = flag; - cf_item_add(cs, cf_datatoitem(cd)); + cf_item_add(cs, cf_data_to_item(cd)); return 0; } diff --git a/src/main/connection.c b/src/main/connection.c index 6f6d69cf4ac..f9cd9caf9ed 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -594,7 +594,7 @@ fr_connection_pool_t *fr_connection_pool_module_init(CONF_SECTION *module, int ret; #define CONNECTION_POOL_CF_KEY "connection_pool" -#define parent_name(_x) cf_section_name(cf_item_parent(cf_sectiontoitem(_x))) +#define parent_name(_x) cf_section_name(cf_item_parent(cf_section_to_item(_x))) cs_name1 = cf_section_name1(module); cs_name2 = cf_section_name2(module); diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index b5ba006b2c4..824f93e02e5 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -301,7 +301,7 @@ static ssize_t xlat_config(UNUSED void *instance, REQUEST *request, char const * return -1; } - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); /* * Ensure that we only copy what's necessary. diff --git a/src/main/map.c b/src/main/map.c index c1f891f4924..74cdecef59a 100644 --- a/src/main/map.c +++ b/src/main/map.c @@ -173,7 +173,7 @@ int map_afrom_cp(TALLOC_CTX *ctx, value_pair_map_t **out, CONF_PAIR *cp, map = talloc_zero(ctx, value_pair_map_t); map->op = cf_pair_operator(cp); - map->ci = cf_pairtoitem(cp); + map->ci = cf_pair_to_item(cp); attr = cf_pair_attr(cp); value = cf_pair_value(cp); @@ -293,7 +293,7 @@ int map_afrom_cs(value_pair_map_t **out, CONF_SECTION *cs, */ parent = cs; - ci = cf_sectiontoitem(cs); + ci = cf_section_to_item(cs); cs_list = p = cf_section_name2(cs); if (cs_list) { @@ -324,7 +324,7 @@ int map_afrom_cs(value_pair_map_t **out, CONF_SECTION *cs, goto error; } - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); if (map_afrom_cp(parent, &map, cp, request_def, dst_list_def, REQUEST_CURRENT, src_list_def) < 0) { goto error; } @@ -922,6 +922,7 @@ int map_to_request(REQUEST *request, value_pair_map_t const *map, radius_map_get if (map->rhs->type == TMPL_TYPE_LIST) { pairfree(list); *list = head; + head = NULL; } else { case T_OP_EQ: rad_assert(map->rhs->type == TMPL_TYPE_EXEC); diff --git a/src/main/modcall.c b/src/main/modcall.c index aeae470b2f3..f8aba74c01b 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -806,7 +806,7 @@ redo: cond.data.map = ↦ map.op = T_OP_CMP_EQ; - map.ci = cf_sectiontoitem(g->cs); + map.ci = cf_section_to_item(g->cs); rad_assert(g->vpt != NULL); @@ -1590,7 +1590,7 @@ defaultactions[RLM_COMPONENT_COUNT][GROUPTYPE_COUNT][RLM_MODULE_NUMCODES] = */ int modcall_fixup_update(value_pair_map_t *map, UNUSED void *ctx) { - CONF_PAIR *cp = cf_itemtopair(map->ci); + CONF_PAIR *cp = cf_item_to_pair(map->ci); /* * Anal-retentive checks. @@ -1886,7 +1886,7 @@ static modcallable *do_compile_modswitch (modcallable *parent, rlm_components_t return NULL; } - subcs = cf_itemtosection(ci); /* can't return NULL */ + subcs = cf_item_to_section(ci); /* can't return NULL */ name1 = cf_section_name1(subcs); if (strcmp(name1, "case") != 0) { @@ -2084,7 +2084,7 @@ static modcallable *do_compile_modbreak(modcallable *parent, for (cs = cf_item_parent(ci); cs != NULL; - cs = cf_item_parent(cf_sectiontoitem(cs))) { + cs = cf_item_parent(cf_section_to_item(cs))) { if (strcmp(cf_section_name1(cs), "foreach") == 0) { break; } @@ -2185,7 +2185,7 @@ static int all_children_are_modules(CONF_SECTION *cs, char const *name) * from doing crazy things. */ if (cf_item_is_section(ci)) { - CONF_SECTION *subcs = cf_itemtosection(ci); + CONF_SECTION *subcs = cf_item_to_section(ci); char const *name1 = cf_section_name1(subcs); if ((strcmp(name1, "if") == 0) || @@ -2202,7 +2202,7 @@ static int all_children_are_modules(CONF_SECTION *cs, char const *name) } if (cf_item_is_pair(ci)) { - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); if (cf_pair_value(cp) != NULL) { cf_log_err(ci, "Entry with no value is invalid"); @@ -2233,7 +2233,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, if (cf_item_is_section(ci)) { char const *name2; - cs = cf_itemtosection(ci); + cs = cf_item_to_section(ci); modrefname = cf_section_name1(cs); name2 = cf_section_name2(cs); if (!name2) name2 = ""; @@ -2374,7 +2374,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, */ } else { CONF_SECTION *loop; - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); modrefname = cf_pair_attr(cp); /* @@ -2425,7 +2425,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, */ for (loop = cf_item_parent(ci); loop && subcs; - loop = cf_item_parent(cf_sectiontoitem(loop))) { + loop = cf_item_parent(cf_section_to_item(loop))) { if (loop == subcs) { subcs = NULL; } @@ -2438,7 +2438,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, if (cf_section_name2(subcs)) { return do_compile_modsingle(parent, component, - cf_sectiontoitem(subcs), + cf_section_to_item(subcs), grouptype, modname); } else { @@ -2589,7 +2589,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, if (cf_item_is_section(ci)) { CONF_ITEM *csi; - cs = cf_itemtosection(ci); + cs = cf_item_to_section(ci); for (csi=cf_item_find_next(cs, NULL); csi != NULL; csi=cf_item_find_next(cs, csi)) { @@ -2602,7 +2602,7 @@ static modcallable *do_compile_modsingle(modcallable *parent, if (!cf_item_is_pair(csi)) continue; - if (!compile_action(csingle, cf_itemtopair(csi))) { + if (!compile_action(csingle, cf_item_to_pair(csi))) { talloc_free(csingle); return NULL; } @@ -2805,7 +2805,7 @@ static modcallable *do_compile_modgroup(modcallable *parent, if (cf_item_is_section(ci)) { char const *junk = NULL; modcallable *single; - CONF_SECTION *subcs = cf_itemtosection(ci); + CONF_SECTION *subcs = cf_item_to_section(ci); single = do_compile_modsingle(c, component, ci, grouptype, &junk); @@ -2822,7 +2822,7 @@ static modcallable *do_compile_modgroup(modcallable *parent, } else { char const *attr, *value; - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); attr = cf_pair_attr(cp); value = cf_pair_value(cp); @@ -2843,7 +2843,7 @@ static modcallable *do_compile_modgroup(modcallable *parent, &junk); if (!single) { if (cf_item_is_pair(ci) && - cf_pair_attr(cf_itemtopair(ci))[0] == '-') { + cf_pair_attr(cf_item_to_pair(ci))[0] == '-') { continue; } @@ -2989,13 +2989,13 @@ static bool pass2_xlat_compile(CONF_ITEM const *ci, value_pair_tmpl_t **pvpt, bo } if (cf_item_is_pair(ci)) { - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); WARN("%s[%d] Please change %%{%s} to &%s", cf_pair_filename(cp), cf_pair_lineno(cp), attr->name, attr->name); } else { - CONF_SECTION *cs = cf_itemtosection(ci); + CONF_SECTION *cs = cf_item_to_section(ci); WARN("%s[%d] Please change %%{%s} to &%s", cf_section_filename(cs), cf_section_lineno(cs), @@ -3446,7 +3446,7 @@ bool modcall_pass2(modcallable *mc) * Statically compile xlats */ if (g->vpt->type == TMPL_TYPE_XLAT) { - if (!pass2_xlat_compile(cf_sectiontoitem(g->cs), + if (!pass2_xlat_compile(cf_section_to_item(g->cs), &g->vpt, true, NULL)) { return false; } @@ -3574,12 +3574,12 @@ bool modcall_pass2(modcallable *mc) * attribute of a different type. */ if (f->vpt->type == TMPL_TYPE_ATTR) { - if (!pass2_xlat_compile(cf_sectiontoitem(g->cs), + if (!pass2_xlat_compile(cf_section_to_item(g->cs), &g->vpt, true, f->vpt->tmpl_da)) { return false; } } else { - if (!pass2_xlat_compile(cf_sectiontoitem(g->cs), + if (!pass2_xlat_compile(cf_section_to_item(g->cs), &g->vpt, true, NULL)) { return false; } diff --git a/src/main/modules.c b/src/main/modules.c index 24d3b99b97c..72f75954332 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -764,7 +764,7 @@ int find_module_sibling_section(CONF_SECTION **out, CONF_SECTION *module, char c * instantiation order issues. */ inst_name = cf_pair_value(cp); - inst = find_module_instance(cf_item_parent(cf_sectiontoitem(module)), inst_name, true); + inst = find_module_instance(cf_item_parent(cf_section_to_item(module)), inst_name, true); /* * Remove the config data we added for loop @@ -1019,7 +1019,7 @@ static int load_component_section(CONF_SECTION *cs, CONF_SECTION *scs = NULL; if (cf_item_is_section(modref)) { - scs = cf_itemtosection(modref); + scs = cf_item_to_section(modref); name1 = cf_section_name1(scs); @@ -1038,7 +1038,7 @@ static int load_component_section(CONF_SECTION *cs, cp = NULL; } else if (cf_item_is_pair(modref)) { - cp = cf_itemtopair(modref); + cp = cf_item_to_pair(modref); } else { continue; /* ignore it */ @@ -1212,7 +1212,7 @@ static int load_byserver(CONF_SECTION *cs) */ if ((section_type_value[comp].attr == PW_AUTH_TYPE) && cf_item_is_pair(modref)) { - CONF_PAIR *cp = cf_itemtopair(modref); + CONF_PAIR *cp = cf_item_to_pair(modref); if (!define_type(cs, da, cf_pair_attr(cp))) { goto error; } @@ -1222,7 +1222,7 @@ static int load_byserver(CONF_SECTION *cs) if (!cf_item_is_section(modref)) continue; - subsubcs = cf_itemtosection(modref); + subsubcs = cf_item_to_section(modref); name1 = cf_section_name1(subsubcs); if (strcmp(name1, section_type_value[comp].typename) == 0) { @@ -1612,7 +1612,7 @@ int modules_hup(CONF_SECTION *modules) */ if (!cf_item_is_section(ci)) continue; - cs = cf_itemtosection(ci); + cs = cf_item_to_section(ci); instname = cf_section_name2(cs); if (!instname) instname = cf_section_name1(cs); @@ -1745,11 +1745,11 @@ int modules_init(CONF_SECTION *config) if (!next || !cf_item_is_section(next)) continue; - subcs = cf_itemtosection(ci); + subcs = cf_item_to_section(ci); name1 = cf_section_name1(subcs); name2 = cf_section_name2(subcs); - duplicate = cf_section_find_name2(cf_itemtosection(next), + duplicate = cf_section_find_name2(cf_item_to_section(next), name1, name2); if (!duplicate) continue; @@ -1791,7 +1791,7 @@ int modules_init(CONF_SECTION *config) * they're referenced at all... */ if (cf_item_is_pair(ci)) { - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); name = cf_pair_attr(cp); module = find_module_instance(modules, name, true); @@ -1811,7 +1811,7 @@ int modules_init(CONF_SECTION *config) CONF_SECTION *subcs; CONF_ITEM *subci; - subcs = cf_itemtosection(ci); + subcs = cf_item_to_section(ci); name = cf_section_name1(subcs); /* @@ -1835,7 +1835,7 @@ int modules_init(CONF_SECTION *config) subci != NULL; subci=cf_item_find_next(subcs, subci)) { if (cf_item_is_pair(subci)) { - cp = cf_itemtopair(subci); + cp = cf_item_to_pair(subci); if (cf_pair_value(cp)) { cf_log_err(subci, "Cannot set return codes in a %s block", cf_section_name1(subcs)); @@ -1868,7 +1868,7 @@ int modules_init(CONF_SECTION *config) * Register a redundant xlat */ if (all_same) { - if (!xlat_register_redundant(cf_itemtosection(ci))) { + if (!xlat_register_redundant(cf_item_to_section(ci))) { WARN("%s[%d] Not registering expansions for %s", cf_section_filename(subcs), cf_section_lineno(subcs), cf_section_name2(subcs)); @@ -1898,7 +1898,7 @@ int modules_init(CONF_SECTION *config) if (!cf_item_is_section(ci)) continue; - subcs = cf_itemtosection(ci); + subcs = cf_item_to_section(ci); name = cf_section_name2(subcs); if (!name) name = cf_section_name1(subcs); diff --git a/src/main/realms.c b/src/main/realms.c index 75ae7e7f197..3774d46f622 100644 --- a/src/main/realms.c +++ b/src/main/realms.c @@ -439,7 +439,7 @@ void realm_home_server_sanitize(home_server_t *home, CONF_SECTION *cs) home->src_ipaddr.af = home->ipaddr.af; } - parent = cf_item_parent(cf_sectiontoitem(cs)); + parent = cf_item_parent(cf_section_to_item(cs)); if (parent && strcmp(cf_section_name1(parent), "server") == 0) { home->parent_server = cf_section_name2(parent); } diff --git a/src/main/threads.c b/src/main/threads.c index 1490e31d49a..ca9091a6063 100644 --- a/src/main/threads.c +++ b/src/main/threads.c @@ -1435,7 +1435,7 @@ void exec_trigger(REQUEST *request, CONF_SECTION *cs, char const *name, int quen return; } - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); if (!cp) return; value = cf_pair_value(cp); diff --git a/src/main/xlat.c b/src/main/xlat.c index 2428f498480..4f3db62fbef 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -808,7 +808,7 @@ static ssize_t xlat_redundant(void *instance, REQUEST *request, if (!cf_item_is_pair(ci)) continue; - name = cf_pair_attr(cf_itemtopair(ci)); + name = cf_pair_attr(cf_item_to_pair(ci)); rad_assert(name != NULL); xlat = xlat_find(name); @@ -859,7 +859,7 @@ static ssize_t xlat_load_balance(void *instance, REQUEST *request, * Plain load balancing: do one child, and only one child. */ if (xr->type == XLAT_LOAD_BALANCE) { - name = cf_pair_attr(cf_itemtopair(found)); + name = cf_pair_attr(cf_item_to_pair(found)); rad_assert(name != NULL); xlat = xlat_find(name); @@ -876,7 +876,7 @@ static ssize_t xlat_load_balance(void *instance, REQUEST *request, */ ci = found; do { - name = cf_pair_attr(cf_itemtopair(ci)); + name = cf_pair_attr(cf_item_to_pair(ci)); rad_assert(name != NULL); xlat = xlat_find(name); @@ -948,7 +948,7 @@ bool xlat_register_redundant(CONF_SECTION *cs) ci = cf_item_find_next(cs, ci)) { if (!cf_item_is_pair(ci)) continue; - if (!xlat_find(cf_pair_attr(cf_itemtopair(ci)))) { + if (!xlat_find(cf_pair_attr(cf_item_to_pair(ci)))) { talloc_free(xr); return false; } diff --git a/src/modules/rlm_couchbase/mod.c b/src/modules/rlm_couchbase/mod.c index 7e2a3e4ec00..ff10d1f24a1 100644 --- a/src/modules/rlm_couchbase/mod.c +++ b/src/modules/rlm_couchbase/mod.c @@ -175,7 +175,7 @@ int mod_build_attribute_element_map(CONF_SECTION *conf, void *instance) } /* get value pair from item */ - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); /* get pair name (element name) */ element = cf_pair_attr(cp); @@ -543,7 +543,7 @@ int mod_client_map_section(CONF_SECTION *client, CONF_SECTION const *map, if (cf_item_is_section(ci)) { CONF_SECTION *cs, *cc; /* local scoped for new section */ - cs = cf_itemtosection(ci); + cs = cf_item_to_section(ci); cc = cf_section_alloc(client, cf_section_name1(cs), cf_section_name2(cs)); if (!cc) return -1; @@ -557,7 +557,7 @@ int mod_client_map_section(CONF_SECTION *client, CONF_SECTION const *map, } /* create pair from item and get attribute name and value */ - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); attribute = cf_pair_attr(cp); element = cf_pair_value(cp); @@ -578,7 +578,7 @@ int mod_client_map_section(CONF_SECTION *client, CONF_SECTION const *map, } /* add pair to section */ - cf_item_add(client, cf_pairtoitem(cp)); + cf_item_add(client, cf_pair_to_item(cp)); } /* return success */ diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index e98657aa620..d22890c887f 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -229,7 +229,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance) if (!cf_item_is_pair(ci)) continue; - attr = cf_pair_attr(cf_itemtopair(ci)); + attr = cf_pair_attr(cf_item_to_pair(ci)); if (!attr) continue; /* pair-anoia */ da = dict_attrbyname(attr); diff --git a/src/modules/rlm_eap/libeap/eap_tls.c b/src/modules/rlm_eap/libeap/eap_tls.c index 73f12f95cb6..dd8048ef3cd 100644 --- a/src/modules/rlm_eap/libeap/eap_tls.c +++ b/src/modules/rlm_eap/libeap/eap_tls.c @@ -937,7 +937,7 @@ fr_tls_server_conf_t *eaptls_conf_parse(CONF_SECTION *cs, char const *attr) rad_assert(attr != NULL); - parent = cf_item_parent(cf_sectiontoitem(cs)); + parent = cf_item_parent(cf_section_to_item(cs)); cp = cf_pair_find(cs, attr); if (cp) { diff --git a/src/modules/rlm_ldap/clients.c b/src/modules/rlm_ldap/clients.c index df69120d2a4..e48b974b410 100644 --- a/src/modules/rlm_ldap/clients.c +++ b/src/modules/rlm_ldap/clients.c @@ -49,11 +49,11 @@ static int rlm_ldap_client_get_attrs(char const **values, int *idx, CONF_SECTION char const *value; if (cf_item_is_section(ci)) { - if (rlm_ldap_client_get_attrs(values, idx, cf_itemtosection(ci)) < 0) return -1; + if (rlm_ldap_client_get_attrs(values, idx, cf_item_to_section(ci)) < 0) return -1; continue; } - value = cf_pair_value(cf_itemtopair(ci)); + value = cf_pair_value(cf_item_to_pair(ci)); if (!value) return -1; values[(*idx)++] = value; @@ -95,7 +95,7 @@ static int rlm_ldap_client_map_section(ldap_instance_t const *inst, CONF_SECTION if (cf_item_is_section(ci)) { CONF_SECTION *cs, *cc; - cs = cf_itemtosection(ci); + cs = cf_item_to_section(ci); cc = cf_section_alloc(client, cf_section_name1(cs), cf_section_name2(cs)); if (!cc) return -1; @@ -105,7 +105,7 @@ static int rlm_ldap_client_map_section(ldap_instance_t const *inst, CONF_SECTION continue; } - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); attr = cf_pair_attr(cp); values = ldap_get_values_len(conn->handle, entry, cf_pair_value(cp)); @@ -120,7 +120,7 @@ static int rlm_ldap_client_map_section(ldap_instance_t const *inst, CONF_SECTION } talloc_free(value); ldap_value_free_len(values); - cf_item_add(client, cf_pairtoitem(cp)); + cf_item_add(client, cf_pair_to_item(cp)); } return 0; diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 3d2bc72959a..7e4d65a77d4 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -684,7 +684,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance) cp = cf_pair_alloc(conf, "server", buff, T_OP_EQ, T_SINGLE_QUOTED_STRING); if (!cp) return -1; - ci = cf_pairtoitem(cp); + ci = cf_pair_to_item(cp); cf_item_add(conf, ci); break; @@ -1382,7 +1382,7 @@ static rlm_rcode_t user_modify(ldap_instance_t *inst, REQUEST *request, ldap_acc goto error; } - cs = cf_section_sub_find(cf_itemtosection(ci), "update"); + cs = cf_section_sub_find(cf_item_to_section(ci), "update"); if (!cs) { REDEBUG("Section must contain 'update' subsection"); @@ -1410,7 +1410,7 @@ static rlm_rcode_t user_modify(ldap_instance_t *inst, REQUEST *request, ldap_acc /* * Retrieve all the information we need about the pair */ - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); value = cf_pair_value(cp); attr = cf_pair_attr(cp); op = cf_pair_operator(cp); diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c index d99691efc9c..1030b74d702 100644 --- a/src/modules/rlm_linelog/rlm_linelog.c +++ b/src/modules/rlm_linelog/rlm_linelog.c @@ -237,7 +237,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_do_linelog(void *instance, REQUEST *requ goto do_log; } - cp = cf_itemtopair(ci); + cp = cf_item_to_pair(ci); value = cf_pair_value(cp); if (!value) { RDEBUG2("Entry \"%s\" has no value", line); diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index 9514eb19032..c2daf2d1e72 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -414,7 +414,7 @@ static void perl_parse_config(CONF_SECTION *cs, int lvl, HV *rad_hv) * Then recursively call perl_parse_config with this section and the new HV. */ if (cf_item_is_section(ci)) { - CONF_SECTION *sub_cs = cf_itemtosection(ci); + CONF_SECTION *sub_cs = cf_item_to_section(ci); char const *key = cf_section_name1(sub_cs); /* hash key */ HV *sub_hv; SV *ref; @@ -433,7 +433,7 @@ static void perl_parse_config(CONF_SECTION *cs, int lvl, HV *rad_hv) perl_parse_config(sub_cs, lvl + 1, sub_hv); } else if (cf_item_is_pair(ci)){ - CONF_PAIR *cp = cf_itemtopair(ci); + CONF_PAIR *cp = cf_item_to_pair(ci); char const *key = cf_pair_attr(cp); /* hash key */ char const *value = cf_pair_value(cp); /* hash value */ diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index e634a22e59e..1d29017afbc 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -1337,7 +1337,7 @@ static int acct_redundant(rlm_sql_t *inst, REQUEST *request, sql_acct_section_t goto finish; } - pair = cf_itemtopair(item); + pair = cf_item_to_pair(item); attr = cf_pair_attr(pair); RDEBUG2("Using query template '%s'", attr);