summaryrefslogtreecommitdiff
path: root/navit/xmlconfig.c
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2018-06-11 00:02:12 +0200
committermvglasow <michael -at- vonglasow.com>2018-06-11 00:02:12 +0200
commitaea6489afff65b85593db83fe8a661bceb80147c (patch)
tree5591b0c618d2a33584f3542628744af4e3bf38ef /navit/xmlconfig.c
parentad318d7fec18389e9cf1810b7470c4cf1377f836 (diff)
parent07006013135b619029f26df579a0ac6acb86cd4a (diff)
downloadnavit-aea6489afff65b85593db83fe8a661bceb80147c.tar.gz
Merge branch 'trunk' into traffic
# Conflicts: # navit/binding/dbus/binding_dbus.c # navit/gui/internal/gui_internal_html.c # navit/route.c # navit/util.c # navit/xmlconfig.c
Diffstat (limited to 'navit/xmlconfig.c')
-rw-r--r--navit/xmlconfig.c136
1 files changed, 54 insertions, 82 deletions
diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c
index c90d9e86b..bed5e4796 100644
--- a/navit/xmlconfig.c
+++ b/navit/xmlconfig.c
@@ -152,8 +152,7 @@ static const char * find_attribute(struct xmlstate *state, const char *attribute
return NULL;
}
-static int
-find_boolean(struct xmlstate *state, const char *attribute, int deflt, int required) {
+static int find_boolean(struct xmlstate *state, const char *attribute, int deflt, int required) {
const char *value;
value=find_attribute(state, attribute, required);
@@ -170,16 +169,14 @@ find_boolean(struct xmlstate *state, const char *attribute, int deflt, int requi
* * @param val the string value to convert
* * @returns int value of converted string
* */
-static int
-convert_number(const char *val) {
+static int convert_number(const char *val) {
if (val)
return g_ascii_strtoull(val,NULL,0);
else
return 0;
}
-static int
-xmlconfig_announce(struct xmlstate *state) {
+static int xmlconfig_announce(struct xmlstate *state) {
const char *type,*value;
char key[32];
int level[3];
@@ -571,13 +568,12 @@ static void initStatic(void) {
* * @returns nothing
* */
-static void
-start_element(xml_context *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- xmlerror **error) {
+static void start_element(xml_context *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ xmlerror **error) {
struct xmlstate *new=NULL, **parent = user_data;
struct element_func *e=elements,*func=NULL;
struct attr_fixme *attr_fixme=attr_fixmes;
@@ -689,11 +685,10 @@ start_element(xml_context *context,
/* Called for close tags </foo> */
-static void
-end_element (xml_context *context,
- const gchar *element_name,
- gpointer user_data,
- xmlerror **error) {
+static void end_element (xml_context *context,
+ const gchar *element_name,
+ gpointer user_data,
+ xmlerror **error) {
struct xmlstate *curr, **state = user_data;
if (!strcmp(element_name,"xml"))
@@ -710,9 +705,8 @@ end_element (xml_context *context,
static gboolean parse_file(struct xmldocument *document, xmlerror **error);
-static void
-xinclude(xml_context *context, const gchar **attribute_names, const gchar **attribute_values,
- struct xmldocument *doc_old, xmlerror **error) {
+static void xinclude(xml_context *context, const gchar **attribute_names, const gchar **attribute_values,
+ struct xmldocument *doc_old, xmlerror **error) {
struct xmldocument doc_new;
struct file_wordexp *we;
int i,count;
@@ -780,8 +774,7 @@ xinclude(xml_context *context, const gchar **attribute_names, const gchar **attr
}
}
-static int
-strncmp_len(const char *s1, int s1len, const char *s2) {
+static int strncmp_len(const char *s1, int s1len, const char *s2) {
int ret;
ret=strncmp(s1, s2, s1len);
if (ret)
@@ -789,8 +782,7 @@ strncmp_len(const char *s1, int s1len, const char *s2) {
return strlen(s2)-s1len;
}
-static int
-xpointer_value(const char *test, int len, struct xistate *elem, const char **out, int out_len) {
+static int xpointer_value(const char *test, int len, struct xistate *elem, const char **out, int out_len) {
int i,ret=0;
if (len <= 0 || out_len <= 0) {
return 0;
@@ -813,8 +805,7 @@ xpointer_value(const char *test, int len, struct xistate *elem, const char **out
return 0;
}
-static int
-xpointer_test(const char *test, int len, struct xistate *elem) {
+static int xpointer_test(const char *test, int len, struct xistate *elem) {
int eq,i,count,vlen,cond_req=1,cond=0;
char c;
const char *tmp[16];
@@ -841,8 +832,7 @@ xpointer_test(const char *test, int len, struct xistate *elem) {
return 0;
}
-static int
-xpointer_element_match(const char *xpointer, int len, struct xistate *elem) {
+static int xpointer_element_match(const char *xpointer, int len, struct xistate *elem) {
int start,tlen;
start=strcspn(xpointer, "[");
if (start > len)
@@ -864,8 +854,7 @@ xpointer_element_match(const char *xpointer, int len, struct xistate *elem) {
}
}
-static int
-xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first) {
+static int xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first) {
const char *c;
int s;
dbg(lvl_info,"%s", xpointer);
@@ -888,8 +877,7 @@ xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first) {
return 1;
}
-static int
-xpointer_match(const char *xpointer, struct xistate *first) {
+static int xpointer_match(const char *xpointer, struct xistate *first) {
char *prefix="xpointer(";
int len;
if (! xpointer)
@@ -903,13 +891,12 @@ xpointer_match(const char *xpointer, struct xistate *first) {
}
-static void
-xi_start_element(xml_context *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- xmlerror **error) {
+static void xi_start_element(xml_context *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ xmlerror **error) {
struct xmldocument *doc=user_data;
struct xistate *xistate;
int i,count=0;
@@ -951,11 +938,10 @@ xi_start_element(xml_context *context,
* * @returns nothing
* */
-static void
-xi_end_element (xml_context *context,
- const gchar *element_name,
- gpointer user_data,
- xmlerror **error) {
+static void xi_end_element (xml_context *context,
+ const gchar *element_name,
+ gpointer user_data,
+ xmlerror **error) {
struct xmldocument *doc=user_data;
struct xistate *xistate=doc->last;
int i=0;
@@ -983,12 +969,11 @@ xi_end_element (xml_context *context,
/* Called for character data */
/* text is not nul-terminated */
-static void
-xi_text (xml_context *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- xmlerror **error) {
+static void xi_text (xml_context *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ xmlerror **error) {
struct xmldocument *doc=user_data;
int i;
if (doc->active) {
@@ -1012,11 +997,11 @@ xi_text (xml_context *context,
}
#if USE_EZXML
-static void
-parse_node_text(ezxml_t node, void *data, void (*start)(void *, const char *, const char **, const char **, void *,
- void *),
- void (*end)(void *, const char *, void *, void *),
- void (*text)(void *, const char *, int, void *, void *)) {
+static void parse_node_text(ezxml_t node, void *data, void (*start)(void *, const char *, const char **, const char **,
+ void *,
+ void *),
+ void (*end)(void *, const char *, void *, void *),
+ void (*text)(void *, const char *, int, void *, void *)) {
while (node) {
if (start)
start(NULL, node->name, (const char **)node->attr, (const char **)(node->attr+1), data, NULL);
@@ -1091,8 +1076,7 @@ int xml_parse_file(char *filename, void *data,
*
* @return True on success, false on failure.
*/
-int
-xml_parse_text(const char *document, void *data,
+int xml_parse_text(const char *document, void *data,
void (*start)(xml_context *, const char *, const char **, const char **, void *, GError **),
void (*end)(xml_context *, const char *, void *, GError **),
void (*text)(xml_context *, const char *, gsize, void *, GError **)) {
@@ -1142,8 +1126,7 @@ static const GMarkupParser parser = {
* * @returns boolean TRUE or FALSE
* */
-static gboolean
-parse_file(struct xmldocument *document, xmlerror **error) {
+static gboolean parse_file(struct xmldocument *document, xmlerror **error) {
xml_context *context;
gchar *contents, *message;
gsize len;
@@ -1200,8 +1183,7 @@ parse_file(struct xmldocument *document, xmlerror **error) {
return result;
}
#else
-static void
-parse_node(struct xmldocument *document, ezxml_t node) {
+static void parse_node(struct xmldocument *document, ezxml_t node) {
while (node) {
xi_start_element(NULL,node->name, node->attr, node->attr+1, document, NULL);
if (node->txt)
@@ -1213,8 +1195,7 @@ parse_node(struct xmldocument *document, ezxml_t node) {
}
}
-static gboolean
-parse_file(struct xmldocument *document, xmlerror **error) {
+static gboolean parse_file(struct xmldocument *document, xmlerror **error) {
FILE *f;
ezxml_t root;
@@ -1267,8 +1248,7 @@ gboolean config_load(const char *filename, xmlerror **error) {
return result;
}
-int
-navit_object_set_methods(void *in, int in_size, void *out, int out_size) {
+int navit_object_set_methods(void *in, int in_size, void *out, int out_size) {
int ret,size=out_size;
if (out_size > in_size) {
ret=-1;
@@ -1298,8 +1278,7 @@ navit_object_ref(struct navit_object *obj) {
return obj;
}
-void
-navit_object_unref(struct navit_object *obj) {
+void navit_object_unref(struct navit_object *obj) {
if (obj) {
obj->refcount--;
dbg(lvl_debug,"refcount %s %p %d",attr_to_name(obj->func->type),obj,obj->refcount);
@@ -1317,8 +1296,7 @@ navit_object_attr_iter_new(void) {
return g_new0(struct attr_iter, 1);
}
-void
-navit_object_attr_iter_destroy(struct attr_iter *iter) {
+void navit_object_attr_iter_destroy(struct attr_iter *iter) {
g_free(iter);
}
@@ -1347,27 +1325,23 @@ navit_object_attr_iter_destroy(struct attr_iter *iter) {
*
* @return True if a matching attribute was found, false if not.
*/
-int
-navit_object_get_attr(struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter) {
+int navit_object_get_attr(struct navit_object *obj, enum attr_type type, struct attr *attr, struct attr_iter *iter) {
return attr_generic_get_attr(obj->attrs, NULL, type, attr, iter);
}
-void
-navit_object_callbacks(struct navit_object *obj, struct attr *attr) {
+void navit_object_callbacks(struct navit_object *obj, struct attr *attr) {
if (obj->attrs && obj->attrs[0] && obj->attrs[0]->type == attr_callback_list)
callback_list_call_attr_2(obj->attrs[0]->u.callback_list, attr->type, attr->u.data, 0);
}
-int
-navit_object_set_attr(struct navit_object *obj, struct attr *attr) {
+int navit_object_set_attr(struct navit_object *obj, struct attr *attr) {
dbg(lvl_debug, "enter, obj=%p, attr=%p (%s)", obj, attr, attr_to_name(attr->type));
obj->attrs=attr_generic_set_attr(obj->attrs, attr);
navit_object_callbacks(obj, attr);
return 1;
}
-int
-navit_object_add_attr(struct navit_object *obj, struct attr *attr) {
+int navit_object_add_attr(struct navit_object *obj, struct attr *attr) {
dbg(lvl_debug, "enter, obj=%p, attr=%p (%s)", obj, attr, attr_to_name(attr->type));
if (attr->type == attr_callback) {
struct callback_list *cbl;
@@ -1389,8 +1363,7 @@ navit_object_add_attr(struct navit_object *obj, struct attr *attr) {
return 1;
}
-int
-navit_object_remove_attr(struct navit_object *obj, struct attr *attr) {
+int navit_object_remove_attr(struct navit_object *obj, struct attr *attr) {
if (attr->type == attr_callback) {
if (obj->attrs && obj->attrs[0] && obj->attrs[0]->type == attr_callback_list) {
callback_list_remove(obj->attrs[0]->u.callback_list, attr->u.callback);
@@ -1404,8 +1377,7 @@ navit_object_remove_attr(struct navit_object *obj, struct attr *attr) {
return 1;
}
-void
-navit_object_destroy(struct navit_object *obj) {
+void navit_object_destroy(struct navit_object *obj) {
attr_list_free(obj->attrs);
g_free(obj);
}