From 8fb8da605419c427605ca91c67b367c9a4cd0eec Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 6 Oct 2020 17:21:54 +0200 Subject: treewide: rework exception context formatting Signed-off-by: Jo-Philipp Wich --- eval.c | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 881766b..1803355 100644 --- a/eval.c +++ b/eval.c @@ -26,38 +26,6 @@ #include #include -char exception_tag_space[sizeof(struct ut_op) + sizeof(struct ut_op *)]; -static struct ut_op *exception_tag = (struct ut_op *)exception_tag_space; - -__attribute__((format(printf, 3, 0))) struct json_object * -ut_exception(struct ut_state *state, uint32_t off, const char *fmt, ...) -{ - struct json_object *msg; - va_list ap; - char *s; - int len; - - va_start(ap, fmt); - len = xvasprintf(&s, fmt, ap); - va_end(ap); - - msg = xjs_new_string_len(s, len); - free(s); - - exception_tag->type = T_EXCEPTION; - exception_tag->tree.operand[0] = off; - - json_object_set_userdata(msg, exception_tag, NULL); - - if (state->error.code == UT_ERROR_EXCEPTION) - json_object_put(state->error.info.exception); - - state->error.code = UT_ERROR_EXCEPTION; - state->error.info.exception = msg; - - return json_object_get(msg); -} - bool ut_val_is_truish(struct json_object *val) { -- cgit v1.2.3