From 7aa82ab7d08f012da50fded7dce93f2adffd2706 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 10 Oct 2013 18:31:10 -0400 Subject: Remove uw_cutErrorLocation() hijinks --- include/urweb/urweb.h | 2 -- src/c/urweb.c | 10 ---------- src/cjr_print.sml | 12 +++++------- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/include/urweb/urweb.h b/include/urweb/urweb.h index 2db8b095..ce5c5734 100644 --- a/include/urweb/urweb.h +++ b/include/urweb/urweb.h @@ -351,8 +351,6 @@ void uw_isPost(uw_context); uw_Basis_bool uw_Basis_currentUrlHasPost(uw_context); uw_Basis_bool uw_Basis_currentUrlHasQueryString(uw_context); -void uw_cutErrorLocation(char *); - uw_Basis_string uw_Basis_fresh(uw_context); uw_Basis_float uw_Basis_floatFromInt(uw_context, uw_Basis_int); diff --git a/src/c/urweb.c b/src/c/urweb.c index e4aff33b..447733be 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -4103,16 +4103,6 @@ void uw_mayReturnIndirectly(uw_context ctx) { ctx->allowed_to_return_indirectly = 1; } -void uw_cutErrorLocation(char *s) { - char *s2; - - s2 = strstr(s, ": "); - if (s2 == NULL || strcspn(s, "<&") < s2 - s) - return; - - memmove(s, s2+2, strlen(s2+2)+1); -} - uw_Basis_string uw_Basis_fresh(uw_context ctx) { int len; char *r; diff --git a/src/cjr_print.sml b/src/cjr_print.sml index d2f77a36..bc8f1be6 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -1617,8 +1617,11 @@ and p_exp' par tail env (e, loc) = string "tmp;", newline, string "uw_error(ctx, FATAL, \"", - string (ErrorMsg.spanToString loc), - string ": %s\", ", + string (if Settings.getDebug () then + ErrorMsg.spanToString loc ^ ": " + else + ""), + string "%s\", ", p_exp' false false env e, string ");", newline, @@ -3515,11 +3518,6 @@ fun p_file env (ds, ps) = NONE => box [] | SOME n => box [string "static void uw_onError(uw_context ctx, char *msg) {", newline, - if Settings.getDebug () then - box [] - else - box [string "uw_cutErrorLocation(msg);", - newline], if !hasJs then box [string "uw_set_script_header(ctx, \"", string allScripts, -- cgit v1.2.3