[asterisk-commits] russell: branch group/appdocsxml r152402 - in /team/group/appdocsxml: include...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 28 12:34:44 CDT 2008
Author: russell
Date: Tue Oct 28 12:34:43 2008
New Revision: 152402
URL: http://svn.digium.com/view/asterisk?view=rev&rev=152402
Log:
Drop the ast_xml_char and ast_xml_attr typedefs in favor of using const char * directly.
The code assumes that these are going to be strings, so there is no need for abstraction
of the type.
Modified:
team/group/appdocsxml/include/asterisk/xml.h
team/group/appdocsxml/include/asterisk/xml_libxml2.h
team/group/appdocsxml/main/pbx.c
team/group/appdocsxml/main/xml.c
Modified: team/group/appdocsxml/include/asterisk/xml.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/xml.h?view=diff&rev=152402&r1=152401&r2=152402
==============================================================================
--- team/group/appdocsxml/include/asterisk/xml.h (original)
+++ team/group/appdocsxml/include/asterisk/xml.h Tue Oct 28 12:34:43 2008
@@ -69,12 +69,12 @@
/*! \brief Free an attribute returned by ast_xml_get_attribute()
* \param data pointer to be freed.
*/
-void ast_xml_free_attr(ast_xml_attr *attribute);
+void ast_xml_free_attr(const char *attribute);
-/*! \brief Free a content element
+/*! \brief Free a content element that was returned by ast_xml_get_text()
* \param text text to be freed.
*/
-void ast_xml_free_text(ast_xml_text *text);
+void ast_xml_free_text(const char *text);
/*! \brief Get a node attribute by name
* \param node Node where to search the attribute.
@@ -82,7 +82,7 @@
* \retval NULL on error
* \retval The attribute value on success.
*/
-ast_xml_attr *ast_xml_get_attribute(ast_xml_node *node, const char *attrname);
+const char *ast_xml_get_attribute(ast_xml_node *node, const char *attrname);
/*! \brief Find a node element by name.
* \param node This is the node starting point.
Modified: team/group/appdocsxml/include/asterisk/xml_libxml2.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/xml_libxml2.h?view=diff&rev=152402&r1=152401&r2=152402
==============================================================================
--- team/group/appdocsxml/include/asterisk/xml_libxml2.h (original)
+++ team/group/appdocsxml/include/asterisk/xml_libxml2.h Tue Oct 28 12:34:43 2008
@@ -25,8 +25,6 @@
typedef xmlNode ast_xml_node;
typedef xmlDoc ast_xml_doc;
-typedef char ast_xml_attr;
-typedef const char ast_xml_text;
/* Node member mapping, not always the child node is called 'children' */
#define AST_XML_CHILD children
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=152402&r1=152401&r2=152402
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Tue Oct 28 12:34:43 2008
@@ -3518,7 +3518,7 @@
{
ast_xml_node *node = NULL;
struct documentation_tree *doctree;
- char *lang;
+ const char *lang;
AST_RWLIST_RDLOCK(&xmldoc_tree);
AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
@@ -3634,7 +3634,7 @@
#define ISLAST(__rev, __a) (__rev == 1 ? (__a->AST_XML_PREV ? 0 : 1) : (__a->AST_XML_NEXT ? 0 : 1))
#define MP(__a) ((multiple ? __a : ""))
ast_xml_node *node = NULL, *firstparam = NULL, *lastparam = NULL;
- ast_xml_attr *paramtype, *multipletype, *paramname, *attrargsep;
+ const char *paramtype, *multipletype, *paramname, *attrargsep;
int reverse, required, paramcount = 0, openbrackets = 0, len = 0, hasparams=0;
int reqfinode = 0, reqlanode = 0, optmidnode = 0;
char *syntax = NULL, *argsep;
@@ -3808,7 +3808,7 @@
}
}
if (paramnamemalloc) {
- ast_free(paramname);
+ ast_free((char *) paramname);
} else {
ast_xml_free_attr(paramname);
}
@@ -3877,7 +3877,7 @@
*/
static int xmldoc_parse_para(ast_xml_node *node, const char *tabs, const char *posttabs, struct ast_str **buffer)
{
- ast_xml_text *tmptext;
+ const char *tmptext;
ast_xml_node *tmp;
int ret = 0;
struct ast_str *tmpstr;
@@ -3981,7 +3981,7 @@
static int xmldoc_parse_argument(ast_xml_node *fixnode, int insideparameter, const char *paramtabs, const char *tabs, struct ast_str **buffer)
{
ast_xml_node *node = fixnode;
- ast_xml_attr *argname;
+ const char *argname;
int count=0, ret = 0;
if (!node || !node->AST_XML_CHILD) {
@@ -4023,8 +4023,8 @@
static int xmldoc_parse_variable(ast_xml_node *node, const char *tabs, struct ast_str **buffer)
{
ast_xml_node *tmp;
- ast_xml_attr *valname;
- ast_xml_text *tmptext;
+ const char *valname;
+ const char *tmptext;
struct ast_str *cleanstr;
int ret = 0, printedpara=0;
@@ -4084,7 +4084,7 @@
static int xmldoc_parse_variablelist(ast_xml_node *node, const char *tabs, struct ast_str **buffer)
{
ast_xml_node *tmp;
- ast_xml_attr *varname;
+ const char *varname;
char *vartabs;
int ret = 0;
@@ -4141,8 +4141,8 @@
struct ast_str *outputstr;
char *output;
ast_xml_node *node;
- ast_xml_attr *typename;
- ast_xml_text *content;
+ const char *typename;
+ const char *content;
if (ast_strlen_zero(type) || ast_strlen_zero(name)) {
return NULL;
@@ -4239,7 +4239,7 @@
static int xmldoc_parse_enumlist(ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer)
{
ast_xml_node *node = fixnode;
- ast_xml_attr *enumname;
+ const char *enumname;
int ret = 0;
for (node = node->AST_XML_CHILD; node; node = node->AST_XML_NEXT) {
@@ -4320,7 +4320,7 @@
static void xmldoc_parse_optionlist(ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer)
{
ast_xml_node *node;
- ast_xml_attr *optname;
+ const char *optname;
char *optionsyntax;
for (node = fixnode->AST_XML_CHILD; node; node = node->AST_XML_NEXT) {
@@ -4357,7 +4357,7 @@
*/
static void xmldoc_parse_parameter(ast_xml_node *fixnode, const char *tabs, struct ast_str **buffer)
{
- ast_xml_attr *paramname;
+ const char *paramname;
ast_xml_node *node = fixnode;
int hasarguments, printed = 0;
char *internaltabs;
@@ -4469,7 +4469,7 @@
static struct ast_str *xmldoc_get_formatted(ast_xml_node *node, int raw_output, int raw_wrap)
{
ast_xml_node *tmp;
- ast_xml_text *notcleanret, *tmpstr;
+ const char *notcleanret, *tmpstr;
struct ast_str *ret = ast_str_create(128);
if (raw_output) {
Modified: team/group/appdocsxml/main/xml.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/xml.c?view=diff&rev=152402&r1=152401&r2=152402
==============================================================================
--- team/group/appdocsxml/main/xml.c (original)
+++ team/group/appdocsxml/main/xml.c Tue Oct 28 12:34:43 2008
@@ -93,21 +93,21 @@
node = NULL;
}
-void ast_xml_free_attr(ast_xml_attr *attribute)
+void ast_xml_free_attr(const char *attribute)
{
if (attribute) {
- xmlFree(attribute);
+ xmlFree((char *) attribute);
}
}
-void ast_xml_free_text(ast_xml_text *text)
+void ast_xml_free_text(const char *text)
{
if (text) {
xmlFree((char *) text);
}
}
-ast_xml_attr *ast_xml_get_attribute(ast_xml_node *node, const char *attrname)
+const char *ast_xml_get_attribute(ast_xml_node *node, const char *attrname)
{
xmlChar *attrvalue;
@@ -121,13 +121,13 @@
attrvalue = xmlGetProp(node, (xmlChar *)attrname);
- return (ast_xml_attr *)attrvalue;
+ return (const char *) attrvalue;
}
ast_xml_node *ast_xml_find_element(ast_xml_node *root_node, const char *name, const char *attrname, const char *attrvalue)
{
xmlNodePtr cur;
- ast_xml_attr *attr;
+ const char *attr;
if (!root_node) {
return NULL;
More information about the asterisk-commits
mailing list