summaryrefslogtreecommitdiffstats
path: root/src/diag.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-12 13:09:11 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-12 13:09:11 -0400
commitda5c9dd34f65989c842cfb831b8592157dd8ed34 (patch)
tree06571b02c096ef6fe2e0c785253b0b151731e205 /src/diag.c
parent257227326fe60fe70e80433fd34d1ebcb2f9f623 (diff)
downloadbfs-da5c9dd34f65989c842cfb831b8592157dd8ed34.tar.xz
diag: Move enum debug_flags out of ctx.h
Diffstat (limited to 'src/diag.c')
-rw-r--r--src/diag.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/diag.c b/src/diag.c
index fa66525..bf2343d 100644
--- a/src/diag.c
+++ b/src/diag.c
@@ -27,6 +27,31 @@ noreturn void bfs_abortf(const struct bfs_loc *loc, const char *format, ...) {
abort();
}
+const char *debug_flag_name(enum debug_flags flag) {
+ switch (flag) {
+ case DEBUG_COST:
+ return "cost";
+ case DEBUG_EXEC:
+ return "exec";
+ case DEBUG_OPT:
+ return "opt";
+ case DEBUG_RATES:
+ return "rates";
+ case DEBUG_SEARCH:
+ return "search";
+ case DEBUG_STAT:
+ return "stat";
+ case DEBUG_TREE:
+ return "tree";
+
+ case DEBUG_ALL:
+ break;
+ }
+
+ bfs_bug("Unrecognized debug flag");
+ return "???";
+}
+
void bfs_perror(const struct bfs_ctx *ctx, const char *str) {
bfs_error(ctx, "%s: %m.\n", str);
}