summaryrefslogtreecommitdiff
path: root/name.c
diff options
context:
space:
mode:
Diffstat (limited to 'name.c')
-rw-r--r--name.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/name.c b/name.c
index f29ce2298b..80ce5d5b36 100644
--- a/name.c
+++ b/name.c
@@ -112,7 +112,6 @@ static void bidi_set_free(Name *name, Set *s) {
Name *other;
assert(name);
- assert(s);
/* Frees the set and makes sure we are dropped from the
* inverse pointers */
@@ -360,3 +359,31 @@ int name_merge(Name *name, Name *other) {
return 0;
}
+
+const char* name_id(Name *n) {
+ assert(n);
+
+ return set_first(n->meta.names);
+}
+
+void name_dump(Name *n, FILE *f) {
+
+ static const char* const state_table[_NAME_STATE_MAX] = {
+ [NAME_STUB] = "STUB",
+ [NAME_LOADED] = "LOADED",
+ [NAME_FAILED] = "FAILED"
+ };
+
+ assert(n);
+
+ fprintf(stderr,
+ "Name %s (%s), state %s\n",
+ name_id(n),
+ n->meta.description ? n->meta.description : name_id(n),
+ state_table[n->meta.state]);
+
+ if (n->meta.job) {
+ fprintf(f, "\tâ–¶ ");
+ job_dump(n->meta.job, f);
+ }
+}