diff src/toy_cache.sml @ 2262:34ad83d9b729

Fix recording bugs to do with nesting and buffer reallocation. Stop MonoFooify printing spurious errors.
author Ziv Scully <ziv@mit.edu>
date Wed, 07 Oct 2015 08:58:08 -0400
parents 6951a645ccdf
children a647a1560628
line wrap: on
line diff
--- a/src/toy_cache.sml	Wed Sep 30 00:33:52 2015 -0400
+++ b/src/toy_cache.sml	Wed Oct 07 08:58:08 2015 -0400
@@ -95,7 +95,7 @@
              string args,
              string ") {",
              newline,
-             string "if (cacheQuery",
+             string "if (cacheWrite",
              string i,
              (* ASK: is returning the pointer okay? Should we duplicate? *)
              string " == NULL",
@@ -116,9 +116,11 @@
              string i,
              string ".\");",
              newline,
-             string "uw_write(ctx, cacheWrite",
+             string " if (cacheWrite",
              string i,
-             string ");",
+             string " != NULL) { uw_write(ctx, cacheWrite",
+             string i,
+             string "); }",
              newline,
              string "return cacheQuery",
              string i,
@@ -176,6 +178,14 @@
              string i,
              string " = NULL;",
              newline,
+             string "free(cacheWrite",
+             string i,
+             string ");",
+             newline,
+             string "cacheWrite",
+             string i,
+             string " = NULL;",
+             newline,
              string "puts(\"SQLCACHE: flush ",
              string i,
              string ".\");}",