diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-06 17:21:54 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-06 17:52:33 +0200 |
commit | 8fb8da605419c427605ca91c67b367c9a4cd0eec (patch) | |
tree | 5033b34dcf71742e5c0e7b32a5bc58fb57fff127 /eval.c | |
parent | 5f19e5870007d57034adea5f124e3c87413a1aaf (diff) |
treewide: rework exception context formatting
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 32 |
1 files changed, 0 insertions, 32 deletions
@@ -26,38 +26,6 @@ #include <stdarg.h> #include <regex.h> -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) { |