From ffb02f79f0381f296e73add258f87ecb2456fba3 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 18 Jun 2017 14:00:02 +0300 Subject: Switch to detailed source locations from Mailutils 3.2.92 * configure.ac: Version 8.1.92 * NEWS: Update. * src/builtin/debug.bi (debug): Use mu_locus_range * src/builtin/from.bi: Likewise. * src/builtin/header.bi: Likewise. * src/builtin/progress.bi: Likewise. * src/builtin/qrnt.bi: Likewise. * src/builtin/rcpt.bi: Likewise. * src/exclist.c: Likewise. * src/builtin/sieve.bi: Use mu_locus_range (sieve): Accept new optional argument "col". * src/drivers.c: Use mu_locus_range (MARK_LOCUS): Rewrite as inline function. * src/gram.y: Use mu_locus_range and location macros from mailutils/yyloc.h Improve error diagnostics (parse_program): Prepare mu_strerr for locus-aware diagnostics. * src/lex.l: Use mu_linetrack_t to track locations. * src/mailfromd.h: Use mu_locus_range * src/main.c: Likewise. * src/pp.c: Likewise. * src/prog.c: Likewise. * src/prog.h: Likewise. * src/symbols.c: Likewise. * tests/ashadow.at: Expect detailed error locations. * tests/bctx00.at: Likewise. * tests/fctx00.at: Likewise. * tests/invcidr.at: Likewise. * tests/invcidr2.at: Likewise. * tests/module04.at: Likewise. * tests/module06.at: Likewise. * tests/poll04.at: Likewise. * tests/setvar.at: Likewise. * tests/shadow.at: Likewise. * tests/static02.at: Likewise. --- src/main.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 49d0217a..66a97808 100644 --- a/src/main.c +++ b/src/main.c @@ -375,7 +375,7 @@ opt_variable(struct mu_parseopt *po, struct mu_option *op, char const *arg) { char *p; - struct locus locus = { "", 1, 0 }; + struct mu_locus_range locus = {{ "", 1, 0 }}; p = strchr(arg, '='); if (!p) { @@ -421,7 +421,6 @@ static void opt_set_milter_timeout(struct mu_parseopt *po, struct mu_option *op, char const *arg) { - int rc; time_t v; if (mu_str_to_c(arg, mu_c_time, &v, NULL)) { @@ -676,8 +675,7 @@ cb_set_variable(void *data, mu_config_value_t *arg) { const char *value; char *alloc_str = NULL; - struct mu_locus mloc; - struct locus locus; + struct mu_locus_range locus = MU_LOCUS_RANGE_INITIALIZER; if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) return 1; @@ -712,24 +710,10 @@ cb_set_variable(void *data, mu_config_value_t *arg) abort(); } - locus.leng = 0; - if (mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_GET_LOCUS, &mloc)) { - locus.file = ""; - locus.line = 0; - locus.point = 0; - } else { - if (mloc.mu_file) { - struct literal *lit = string_alloc(mloc.mu_file, - strlen(mloc.mu_file)); - free(mloc.mu_file); - locus.file = lit->text; - } else - locus.file = ""; - locus.line = mloc.mu_line; - locus.point = mloc.mu_col; - } + mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_GET_LOCUS_RANGE, &locus); defer_initialize_variable(arg->v.arg.v[0].v.string, value, &locus); + mu_locus_range_deinit(&locus); free(alloc_str); return 0; } @@ -1119,7 +1103,6 @@ static int args_in_order(int argc, char **argv) { int i; - int flag = 0; for (i = 0; i < argc; i++) { size_t len = strcspn(argv[i], "="); if (len > 3 @@ -1244,7 +1227,6 @@ struct mu_cli_setup cli = { int main(int argc, char **argv) { - int rc; prog_counter_t entry_point; int stderr_is_closed = stderr_closed_p(); -- cgit v1.2.1