core: Config and XML tweaks needed for geolocation

Added:

Replace a variable in a list:
int ast_variable_list_replace_variable(struct ast_variable **head,
    struct ast_variable *old, struct ast_variable *new);
Added test as well.

Create a "name=value" string from a variable list:
'name1="val1",name2="val2"', etc.
struct ast_str *ast_variable_list_join(
    const struct ast_variable *head, const char *item_separator,
    const char *name_value_separator, const char *quote_char,
    struct ast_str **str);
Added test as well.

Allow the name of an XML element to be changed.
void ast_xml_set_name(struct ast_xml_node *node, const char *name);

Change-Id: I330a5f63dc0c218e0d8dfc0745948d2812141ccb
This commit is contained in:
George Joseph
2022-02-20 13:16:22 -07:00
parent 4afe2355be
commit 157a9e64c1
5 changed files with 149 additions and 0 deletions

View File

@@ -332,6 +332,15 @@ void ast_xml_set_text(struct ast_xml_node *node, const char *content)
xmlNodeSetContent((xmlNode *) node, (const xmlChar *) content);
}
void ast_xml_set_name(struct ast_xml_node *node, const char *name)
{
if (!node || !name) {
return;
}
xmlNodeSetName((xmlNode *) node, (const xmlChar *) name);
}
int ast_xml_doc_dump_file(FILE *output, struct ast_xml_doc *doc)
{
return xmlDocDump(output, (xmlDocPtr)doc);