chiark / gitweb /
changelog: document changes since 0.6.0
[secnet.git] / log.c
diff --git a/log.c b/log.c
index 1ff2e5cd8c19df25c8da074df1b2e6733f6977b3..aca1b9b8e415ea6a86fc89e20a68144cbcd4467c 100644 (file)
--- a/log.c
+++ b/log.c
@@ -162,6 +162,18 @@ void cfgfatal_maybefile(FILE *maybe_f, struct cloc loc, cstring_t facility,
     va_end(args);
 }    
 
+void cfgfatal_cl_type(struct cloc loc, const char *facility,
+                     closure_t *cl, uint32_t exp_type, const char *name)
+{
+    char expbuf[10], gotbuf[10];
+    assert(cl->type != exp_type);
+    const char *exp = closure_type_name(exp_type, expbuf);
+    const char *got = closure_type_name(cl->type, gotbuf);
+    cfgfatal(loc,facility,
+            "\"%s\" is the wrong type of closure (expected %s, got %s)\n",
+            name, exp, got);
+}
+
 void cfgfatal(struct cloc loc, cstring_t facility, const char *message, ...)
 {
     va_list args;