]> jfr.im git - irc/quakenet/newserv.git/blobdiff - sqlite/sqlite.c
merge
[irc/quakenet/newserv.git] / sqlite / sqlite.c
index 3ed1c741a5da61822566b418b48f407b194d89f0..904ad13d79d05750e54602b39b7a7507a9648456 100644 (file)
@@ -234,16 +234,16 @@ int sqliteconnected(void) {
 
 size_t sqliteescapestring(char *buf, char *src, unsigned int len) {
   unsigned int i;
-  char *p;
+  char *p, *d;
 
-  for(p=src,i=0;i<len;i++,p++) {
+  for(p=src,d=buf,i=0;i<len;i++,p++) {
     if(*p == '\'')
-      *buf++ = *p;
-    *buf++ = *p;
+      *d++ = *p;
+    *d++ = *p;
   }
-  *buf = '\0';
+  *d = '\0';
 
-  return p - src;
+  return d - buf;
 }
 
 SQLiteResult *sqlitegetresult(SQLiteConn *r) {
@@ -321,12 +321,12 @@ static void loadtablerows(SQLiteConn *c, void *tag) {
 
   /* the handlers do all the checking and cleanup */
   if(t->init)
-    (t->init)(c, t->tag);
+    (t->init)(NULL, t->tag);
 
   (t->data)(c, t->tag);
 
   if(t->fini)
-    (t->fini)(c, t->tag);
+    (t->fini)(NULL, t->tag);
 
   nsfree(POOL_SQLITE, t);
 }