diff src/c/urweb.c @ 2281:75cb60a7f6f1

Simplify C interface.
author Ziv Scully <ziv@mit.edu>
date Thu, 12 Nov 2015 09:15:50 -0500
parents 985c8016b592
children 19b233bb3176
line wrap: on
line diff
--- a/src/c/urweb.c	Thu Nov 12 08:46:51 2015 -0500
+++ b/src/c/urweb.c	Thu Nov 12 09:15:50 2015 -0500
@@ -488,7 +488,7 @@
   char *output_buffer;
   size_t output_buffer_size;
 
-  // For caching.
+  // Sqlcache.
   int numRecording;
   int recordingOffset;
 
@@ -4616,7 +4616,8 @@
 // The NUL-terminated prefix of [key] below always looks something like "_k1_k2_k3..._kn".
 // TODO: strlen(key) = buf - key?
 
-uw_Sqlcache_Value *uw_Sqlcache_check(uw_Sqlcache_Cache *cache, char **keys, int numKeys) {
+uw_Sqlcache_Value *uw_Sqlcache_check(uw_Sqlcache_Cache *cache, char **keys) {
+  size_t numKeys = cache->numKeys;
   char *key = uw_Sqlcache_allocKeyBuffer(keys, numKeys);
   char *buf = key;
   time_t timeInvalid = cache->timeInvalid;
@@ -4636,7 +4637,8 @@
   return value && value->timeValid > timeInvalid ? value : NULL;
 }
 
-void uw_Sqlcache_store(uw_Sqlcache_Cache *cache, char **keys, int numKeys, uw_Sqlcache_Value *value) {
+void uw_Sqlcache_store(uw_Sqlcache_Cache *cache, char **keys, uw_Sqlcache_Value *value) {
+  size_t numKeys = cache->numKeys;
   char *key = uw_Sqlcache_allocKeyBuffer(keys, numKeys);
   char *buf = key;
   time_t timeNow = uw_Sqlcache_getTimeNow(cache);
@@ -4659,7 +4661,8 @@
   entry->value->timeValid = timeNow;
 }
 
-void uw_Sqlcache_flush(uw_Sqlcache_Cache *cache, char **keys, int numKeys) {
+void uw_Sqlcache_flush(uw_Sqlcache_Cache *cache, char **keys) {
+  size_t numKeys = cache->numKeys;
   char *key = uw_Sqlcache_allocKeyBuffer(keys, numKeys);
   char *buf = key;
   time_t timeNow = uw_Sqlcache_getTimeNow(cache);