Skip to content

Commit

Permalink
Remove templating from cf_pair_find().
Browse files Browse the repository at this point in the history
This breaks the server, so the next commit will add templates
back in again, in a better fashion.

We also remove the ability to do cf_pair_find(cs, NULL), and have
it return the first CONF_PAIR.  After searching the code, no one
uses this functionality.  So it's best to remove it.
  • Loading branch information
alandekok committed Feb 11, 2014
1 parent 1915b61 commit c33babc
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions src/main/conffile.c
Expand Up @@ -2010,33 +2010,12 @@ void cf_file_free(CONF_SECTION *cs)
*/
CONF_PAIR *cf_pair_find(CONF_SECTION const *cs, char const *name)
{
CONF_ITEM *ci;
CONF_PAIR *cp = NULL;

if (!cs) return NULL;

/*
* Find the name in the tree, for speed.
*/
if (name) {
CONF_PAIR mycp;
CONF_PAIR mycp;

mycp.attr = name;
cp = rbtree_finddata(cs->pair_tree, &mycp);
} else {
/*
* Else find the first one that matches
*/
for (ci = cs->children; ci; ci = ci->next) {
if (ci->type == CONF_ITEM_PAIR) {
return cf_itemtopair(ci);
}
}
}

if (cp || !cs->template) return cp;
if (!cs || !name) return NULL;

return cf_pair_find(cs->template, name);
mycp.attr = name;
return rbtree_finddata(cs->pair_tree, &mycp);
}

/*
Expand Down

0 comments on commit c33babc

Please sign in to comment.