changeset 1880:0354df1b6849

Remove uw_cutErrorLocation() hijinks
author Adam Chlipala <adam@chlipala.net>
date Thu, 10 Oct 2013 18:31:10 -0400 (2013-10-10)
parents c1ee5dec9cff
children a5b08bdfa450
files include/urweb/urweb.h src/c/urweb.c src/cjr_print.sml
diffstat 3 files changed, 5 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/include/urweb/urweb.h	Thu Oct 10 18:04:29 2013 -0400
+++ b/include/urweb/urweb.h	Thu Oct 10 18:31:10 2013 -0400
@@ -351,8 +351,6 @@
 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);
--- a/src/c/urweb.c	Thu Oct 10 18:04:29 2013 -0400
+++ b/src/c/urweb.c	Thu Oct 10 18:31:10 2013 -0400
@@ -4103,16 +4103,6 @@
   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;
--- a/src/cjr_print.sml	Thu Oct 10 18:04:29 2013 -0400
+++ b/src/cjr_print.sml	Thu Oct 10 18:31:10 2013 -0400
@@ -1617,8 +1617,11 @@
              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 @@
                  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,