diff options
author | mvglasow <michael -at- vonglasow.com> | 2015-11-20 17:12:03 +0100 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2015-11-20 17:50:18 +0100 |
commit | dc779469d01eca1cb8f8ed3b7cbd30aa3265f902 (patch) | |
tree | fa8dd272bec8bb80545ac121b9760ca5dc5bc23e | |
parent | 9df63b5755630cfec2747efe2b28ada24ddf90e9 (diff) | |
download | navit-dc779469d01eca1cb8f8ed3b7cbd30aa3265f902.tar.gz |
Refactor:core:Add some debug output for attribute-related methods
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rw-r--r-- | navit/attr.c | 2 | ||||
-rw-r--r-- | navit/command.c | 6 | ||||
-rw-r--r-- | navit/navit.c | 4 | ||||
-rw-r--r-- | navit/xmlconfig.c | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/navit/attr.c b/navit/attr.c index a4e38f09e..2ae4cec65 100644 --- a/navit/attr.c +++ b/navit/attr.c @@ -614,6 +614,7 @@ attr_generic_set_attr(struct attr **attrs, struct attr *attr) { struct attr **curr=attrs; int i,count=0; + dbg(lvl_debug, "enter, attrs=%p, attr=%p (%s)\n", attrs, attr, attr_to_name(attr->type)); while (curr && *curr) { if ((*curr)->type == attr->type) { attr_free(*curr); @@ -646,6 +647,7 @@ attr_generic_add_attr(struct attr **attrs, struct attr *attr) { struct attr **curr=attrs; int i,count=0; + dbg(lvl_debug, "enter, attrs=%p, attr=%p (%s)\n", attrs, attr, attr_to_name(attr->type)); while (curr && *curr) { curr++; count++; diff --git a/navit/command.c b/navit/command.c index 7ebfda4f5..5b8aac910 100644 --- a/navit/command.c +++ b/navit/command.c @@ -253,11 +253,15 @@ command_object_get_attr(struct context *ctx, struct attr *object, enum attr_type int r; struct attr dup; struct object_func *func=object_func_lookup(object->type); - if (!object->u.data || !func || !func->get_attr) + if (!object->u.data || !func || !func->get_attr) { + dbg(lvl_warning, "cannot retrieve attributes from %s (%p), func=%p\n", attr_to_name(object->type), object->u.data, func) return 0; + } r=func->get_attr(object->u.data, attr_type, &dup, NULL); if(r) attr_dup_content(&dup,ret); + else + dbg(lvl_warning, "%s (%p) has no attribute %s\n", attr_to_name(object->type), object->u.data, attr_to_name(attr_type)) return r; } diff --git a/navit/navit.c b/navit/navit.c index f9a96df20..e54f5934b 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -2443,6 +2443,8 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init) active.type=attr_active; active.u.num=0; + dbg(lvl_debug, "enter, this_=%p, attr=%p (%s), init=%d\n", this_, attr, attr_to_name(attr->type), init); + switch (attr->type) { case attr_autozoom: attr_updated=(this_->autozoom_secs != attr->u.num); @@ -2635,6 +2637,7 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init) this_->waypoints_flag=!!attr->u.num; break; default: + dbg(lvl_warning, "attribute type %s not supported by navit\n", attr_to_name(attr->type)) return 0; } if (attr_updated && !init) { @@ -2852,6 +2855,7 @@ navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, stru attr->u.num=this_->waypoints_flag; break; default: + dbg(lvl_warning, "attribute type %s not supported by navit\n", attr_to_name(type)) return 0; } attr->type=type; diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c index f752998eb..36f7965cc 100644 --- a/navit/xmlconfig.c +++ b/navit/xmlconfig.c @@ -1336,6 +1336,7 @@ navit_object_callbacks(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)\n", obj, attr, attr_to_name(attr->type)); obj->attrs=attr_generic_set_attr(obj->attrs, attr); navit_object_callbacks(obj, attr); return 1; @@ -1344,6 +1345,7 @@ navit_object_set_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)\n", obj, attr, attr_to_name(attr->type)); if (attr->type == attr_callback) { struct callback_list *cbl; if (obj->attrs && obj->attrs[0] && obj->attrs[0]->type == attr_callback_list) |