aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lru_cache.sml
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-11-12 09:15:50 -0500
committerGravatar Ziv Scully <ziv@mit.edu>2015-11-12 09:15:50 -0500
commit011b7148c87f8b0d90abee2f454ef7689493e1f9 (patch)
treef5b03f75a02e3e5c82828452198dde19e048554d /src/lru_cache.sml
parent6205c6660874af4147828e2610ca5c2feec834ad (diff)
Simplify C interface.
Diffstat (limited to 'src/lru_cache.sml')
-rw-r--r--src/lru_cache.sml11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lru_cache.sml b/src/lru_cache.sml
index 6fcfdc55..d4da2849 100644
--- a/src/lru_cache.sml
+++ b/src/lru_cache.sml
@@ -62,14 +62,14 @@ fun setupQuery {index, params} =
val revArgs = paramRepeatRev (fn p => "p" ^ p) ", "
- val numArgs = Int.toString params
-
in
Print.box
[string ("static uw_Sqlcache_Cache cacheStruct" ^ i ^ " = {"),
newline,
string " .table = NULL,",
newline,
+ string (" .numKeys = " ^ Int.toString params ^ ","),
+ newline,
string " .timeInvalid = 0,",
newline,
string " .timeNow = 0};",
@@ -83,8 +83,7 @@ fun setupQuery {index, params} =
newline,
string (" char *ks[] = {" ^ revArgs ^ "};"),
newline,
- string " uw_Sqlcache_Value *v = ",
- string ("uw_Sqlcache_check(cache" ^ i ^ ", ks, " ^ numArgs ^ ");"),
+ string (" uw_Sqlcache_Value *v = uw_Sqlcache_check(cache" ^ i ^ ", ks);"),
newline,
(* If the output is null, it means we had too much recursion, so it's a miss. *)
string " if (v && v->output != NULL) {",
@@ -122,7 +121,7 @@ fun setupQuery {index, params} =
newline,
string (" puts(\"SQLCACHE: stored " ^ i ^ ".\");"),
newline,
- string (" uw_Sqlcache_store(cache" ^ i ^ ", ks, " ^ numArgs ^ ", v);"),
+ string (" uw_Sqlcache_store(cache" ^ i ^ ", ks, v);"),
newline,
string " return uw_unit_v;",
newline,
@@ -135,7 +134,7 @@ fun setupQuery {index, params} =
newline,
string (" char *ks[] = {" ^ revArgs ^ "};"),
newline,
- string (" uw_Sqlcache_flush(cache" ^ i ^ ", ks, " ^ numArgs ^ ");"),
+ string (" uw_Sqlcache_flush(cache" ^ i ^ ", ks);"),
newline,
string " return uw_unit_v;",
newline,