3c57fe6
diff -up sqlite-2.8.17/main.mk.suse sqlite-2.8.17/main.mk
3c57fe6
--- sqlite-2.8.17/main.mk.suse	2019-04-10 13:58:27.732431498 -0400
3c57fe6
+++ sqlite-2.8.17/main.mk	2019-04-10 13:58:44.004100000 -0400
3c57fe6
@@ -145,7 +145,7 @@ all:	sqlite.h config.h libsqlite.a sqlit
3c57fe6
 # of the most recently modified source code file
3c57fe6
 #
3c57fe6
 last_change:	$(SRC)
3c57fe6
-	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
3c57fe6
+	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \
3c57fe6
           | awk '{print $$5,$$6}' >last_change
3c57fe6
 
3c57fe6
 libsqlite.a:	$(LIBOBJ)
3c57fe6
diff -up sqlite-2.8.17/Makefile.in.suse sqlite-2.8.17/Makefile.in
3c57fe6
--- sqlite-2.8.17/Makefile.in.suse	2019-04-10 13:56:27.446882088 -0400
3c57fe6
+++ sqlite-2.8.17/Makefile.in	2019-04-10 13:58:22.316541835 -0400
3c57fe6
@@ -26,7 +26,7 @@ BCC = @BUILD_CC@ @BUILD_CFLAGS@
3c57fe6
 # will run on the target platform.  (BCC and TCC are usually the
3c57fe6
 # same unless your are cross-compiling.)
3c57fe6
 #
3c57fe6
-TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src
3c57fe6
+TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src -DTHREADSAFE=1
3c57fe6
 
3c57fe6
 # Some standard variables and programs
3c57fe6
 #
3c57fe6
@@ -184,7 +184,7 @@ Makefile: $(TOP)/Makefile.in
3c57fe6
 # of the most recently modified source code file
3c57fe6
 #
3c57fe6
 last_change:	$(SRC)
3c57fe6
-	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
3c57fe6
+	cat $(SRC) | grep '$$Id: ' | sort +4 | tail -n 1 \
3c57fe6
           | awk '{print $$5,$$6}' >last_change
3c57fe6
 
3c57fe6
 libsqlite.la:	$(LIBOBJ)
3c57fe6
@@ -365,7 +365,7 @@ tclsqlite:	tclsqlite-sh.lo libsqlite.la
3c57fe6
 testfixture@TARGET_EXEEXT@:	$(TOP)/src/tclsqlite.c libtclsqlite.la libsqlite.la $(TESTSRC)
3c57fe6
 	$(LTLINK) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1\
3c57fe6
                 -o testfixture $(TESTSRC) $(TOP)/src/tclsqlite.c \
3c57fe6
-		libtclsqlite.la libsqlite.la $(LIBTCL)
3c57fe6
+		libtclsqlite.la libsqlite.la $(LIBTCL) -lpthread
3c57fe6
 
3c57fe6
 fulltest:	testfixture@TARGET_EXEEXT@ sqlite@TARGET_EXEEXT@
3c57fe6
 	./testfixture $(TOP)/test/all.test
3c57fe6
diff -up sqlite-2.8.17/src/attach.c.suse sqlite-2.8.17/src/attach.c
3c57fe6
--- sqlite-2.8.17/src/attach.c.suse	2019-04-10 13:58:52.066935738 -0400
3c57fe6
+++ sqlite-2.8.17/src/attach.c	2019-04-10 13:59:35.179057409 -0400
3c57fe6
@@ -48,7 +48,7 @@ void sqliteAttach(Parse *pParse, Token *
3c57fe6
   }
3c57fe6
 
3c57fe6
   zFile = 0;
3c57fe6
-  sqliteSetNString(&zFile, pFilename->z, pFilename->n, 0);
3c57fe6
+  sqliteSetNString(&zFile, pFilename->z, pFilename->n, (char*)0);
3c57fe6
   if( zFile==0 ) return;
3c57fe6
   sqliteDequote(zFile);
3c57fe6
 #ifndef SQLITE_OMIT_AUTHORIZATION
3c57fe6
@@ -59,7 +59,7 @@ void sqliteAttach(Parse *pParse, Token *
3c57fe6
 #endif /* SQLITE_OMIT_AUTHORIZATION */
3c57fe6
 
3c57fe6
   zName = 0;
3c57fe6
-  sqliteSetNString(&zName, pDbname->z, pDbname->n, 0);
3c57fe6
+  sqliteSetNString(&zName, pDbname->z, pDbname->n, (char*)0);
3c57fe6
   if( zName==0 ) return;
3c57fe6
   sqliteDequote(zName);
3c57fe6
   for(i=0; i<db->nDb; i++){
3c57fe6
diff -up sqlite-2.8.17/src/build.c.suse sqlite-2.8.17/src/build.c
3c57fe6
--- sqlite-2.8.17/src/build.c.suse	2019-04-10 13:59:41.010938595 -0400
3c57fe6
+++ sqlite-2.8.17/src/build.c	2019-04-10 14:01:24.312835795 -0400
3c57fe6
@@ -559,7 +559,7 @@ void sqliteAddColumn(Parse *pParse, Toke
3c57fe6
   char *z = 0;
3c57fe6
   Column *pCol;
3c57fe6
   if( (p = pParse->pNewTable)==0 ) return;
3c57fe6
-  sqliteSetNString(&z, pName->z, pName->n, 0);
3c57fe6
+  sqliteSetNString(&z, pName->z, pName->n, (char*)0);
3c57fe6
   if( z==0 ) return;
3c57fe6
   sqliteDequote(z);
3c57fe6
   for(i=0; i<p->nCol; i++){
3c57fe6
@@ -617,7 +617,7 @@ void sqliteAddColumnType(Parse *pParse,
3c57fe6
   pCol = &p->aCol[i];
3c57fe6
   pz = &pCol->zType;
3c57fe6
   n = pLast->n + Addr(pLast->z) - Addr(pFirst->z);
3c57fe6
-  sqliteSetNString(pz, pFirst->z, n, 0);
3c57fe6
+  sqliteSetNString(pz, pFirst->z, n, (char*)0);
3c57fe6
   z = *pz;
3c57fe6
   if( z==0 ) return;
3c57fe6
   for(i=j=0; z[i]; i++){
3c57fe6
@@ -650,9 +650,9 @@ void sqliteAddDefaultValue(Parse *pParse
3c57fe6
   if( i<0 ) return;
3c57fe6
   pz = &p->aCol[i].zDflt;
3c57fe6
   if( minusFlag ){
3c57fe6
-    sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, 0);
3c57fe6
+    sqliteSetNString(pz, "-", 1, pVal->z, pVal->n, (char*)0);
3c57fe6
   }else{
3c57fe6
-    sqliteSetNString(pz, pVal->z, pVal->n, 0);
3c57fe6
+    sqliteSetNString(pz, pVal->z, pVal->n, (char*)0);
3c57fe6
   }
3c57fe6
   sqliteDequote(*pz);
3c57fe6
 }
3c57fe6
@@ -1856,7 +1856,7 @@ IdList *sqliteIdListAppend(IdList *pList
3c57fe6
   memset(&pList->a[pList->nId], 0, sizeof(pList->a[0]));
3c57fe6
   if( pToken ){
3c57fe6
     char **pz = &pList->a[pList->nId].zName;
3c57fe6
-    sqliteSetNString(pz, pToken->z, pToken->n, 0);
3c57fe6
+    sqliteSetNString(pz, pToken->z, pToken->n, (char*)0);
3c57fe6
     if( *pz==0 ){
3c57fe6
       sqliteIdListDelete(pList);
3c57fe6
       return 0;
3c57fe6
@@ -1921,7 +1921,7 @@ SrcList *sqliteSrcListAppend(SrcList *pL
3c57fe6
   }
3c57fe6
   if( pTable ){
3c57fe6
     char **pz = &pList->a[pList->nSrc].zName;
3c57fe6
-    sqliteSetNString(pz, pTable->z, pTable->n, 0);
3c57fe6
+    sqliteSetNString(pz, pTable->z, pTable->n, (char*)0);
3c57fe6
     if( *pz==0 ){
3c57fe6
       sqliteSrcListDelete(pList);
3c57fe6
       return 0;
3c57fe6
@@ -1931,7 +1931,7 @@ SrcList *sqliteSrcListAppend(SrcList *pL
3c57fe6
   }
3c57fe6
   if( pDatabase ){
3c57fe6
     char **pz = &pList->a[pList->nSrc].zDatabase;
3c57fe6
-    sqliteSetNString(pz, pDatabase->z, pDatabase->n, 0);
3c57fe6
+    sqliteSetNString(pz, pDatabase->z, pDatabase->n, (char*)0);
3c57fe6
     if( *pz==0 ){
3c57fe6
       sqliteSrcListDelete(pList);
3c57fe6
       return 0;
3c57fe6
@@ -1962,7 +1962,7 @@ void sqliteSrcListAssignCursors(Parse *p
3c57fe6
 void sqliteSrcListAddAlias(SrcList *pList, Token *pToken){
3c57fe6
   if( pList && pList->nSrc>0 ){
3c57fe6
     int i = pList->nSrc - 1;
3c57fe6
-    sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, 0);
3c57fe6
+    sqliteSetNString(&pList->a[i].zAlias, pToken->z, pToken->n, (char*)0);
3c57fe6
     sqliteDequote(pList->a[i].zAlias);
3c57fe6
   }
3c57fe6
 }
3c57fe6
diff -up sqlite-2.8.17/src/expr.c.suse sqlite-2.8.17/src/expr.c
3c57fe6
--- sqlite-2.8.17/src/expr.c.suse	2019-04-10 14:30:57.775728582 -0400
3c57fe6
+++ sqlite-2.8.17/src/expr.c	2019-04-10 14:31:15.127321739 -0400
3c57fe6
@@ -269,7 +269,7 @@ ExprList *sqliteExprListAppend(ExprList
3c57fe6
     memset(pItem, 0, sizeof(*pItem));
3c57fe6
     pItem->pExpr = pExpr;
3c57fe6
     if( pName ){
3c57fe6
-      sqliteSetNString(&pItem->zName, pName->z, pName->n, 0);
3c57fe6
+      sqliteSetNString(&pItem->zName, pName->z, pName->n, (char*)0);
3c57fe6
       sqliteDequote(pItem->zName);
3c57fe6
     }
3c57fe6
   }
3c57fe6
diff -up sqlite-2.8.17/src/pragma.c.suse sqlite-2.8.17/src/pragma.c
3c57fe6
--- sqlite-2.8.17/src/pragma.c.suse	2019-04-10 14:31:21.335176252 -0400
3c57fe6
+++ sqlite-2.8.17/src/pragma.c	2019-04-10 14:31:38.126782727 -0400
3c57fe6
@@ -167,7 +167,7 @@ void sqlitePragma(Parse *pParse, Token *
3c57fe6
   sqliteDequote(zLeft);
3c57fe6
   if( minusFlag ){
3c57fe6
     zRight = 0;
3c57fe6
-    sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, 0);
3c57fe6
+    sqliteSetNString(&zRight, "-", 1, pRight->z, pRight->n, (char*)0);
3c57fe6
   }else{
3c57fe6
     zRight = sqliteStrNDup(pRight->z, pRight->n);
3c57fe6
     sqliteDequote(zRight);
3c57fe6
diff -up sqlite-2.8.17/src/printf.c.suse sqlite-2.8.17/src/printf.c
3c57fe6
--- sqlite-2.8.17/src/printf.c.suse	2019-04-10 14:31:45.198616993 -0400
3c57fe6
+++ sqlite-2.8.17/src/printf.c	2019-04-10 14:33:50.164555108 -0400
3c57fe6
@@ -647,7 +647,7 @@ struct sgMprintf {
3c57fe6
   int  nChar;      /* Length of the string so far */
3c57fe6
   int  nTotal;     /* Output size if unconstrained */
3c57fe6
   int  nAlloc;     /* Amount of space allocated in zText */
3c57fe6
-  void *(*xRealloc)(void*,int);  /* Function used to realloc memory */
3c57fe6
+  void *(*xRealloc)(void*,size_t);  /* Function used to realloc memory */
3c57fe6
 };
3c57fe6
 
3c57fe6
 /* 
3c57fe6
@@ -688,7 +688,7 @@ static void mout(void *arg, const char *
3c57fe6
 ** the consumer.  
3c57fe6
 */
3c57fe6
 static char *base_vprintf(
3c57fe6
-  void *(*xRealloc)(void*,int),   /* Routine to realloc memory. May be NULL */
3c57fe6
+  void *(*xRealloc)(void*,size_t),   /* Routine to realloc memory. May be NULL */
3c57fe6
   int useInternal,                /* Use internal %-conversions if true */
3c57fe6
   char *zInitBuf,                 /* Initially write here, before mallocing */
3c57fe6
   int nInitBuf,                   /* Size of zInitBuf[] */
3c57fe6
@@ -715,7 +715,7 @@ static char *base_vprintf(
3c57fe6
 /*
3c57fe6
 ** Realloc that is a real function, not a macro.
3c57fe6
 */
3c57fe6
-static void *printf_realloc(void *old, int size){
3c57fe6
+static void *printf_realloc(void *old, size_t size){
3c57fe6
   return sqliteRealloc(old,size);
3c57fe6
 }
3c57fe6
 
3c57fe6
@@ -752,8 +752,7 @@ char *sqlite_mprintf(const char *zFormat
3c57fe6
   char zBuf[200];
3c57fe6
 
3c57fe6
   va_start(ap,zFormat);
3c57fe6
-  z = base_vprintf((void*(*)(void*,int))realloc, 0, 
3c57fe6
-                   zBuf, sizeof(zBuf), zFormat, ap);
3c57fe6
+  z = base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap);
3c57fe6
   va_end(ap);
3c57fe6
   return z;
3c57fe6
 }
3c57fe6
@@ -762,8 +761,7 @@ char *sqlite_mprintf(const char *zFormat
3c57fe6
 */
3c57fe6
 char *sqlite_vmprintf(const char *zFormat, va_list ap){
3c57fe6
   char zBuf[200];
3c57fe6
-  return base_vprintf((void*(*)(void*,int))realloc, 0,
3c57fe6
-                      zBuf, sizeof(zBuf), zFormat, ap);
3c57fe6
+  return base_vprintf(realloc, 0, zBuf, sizeof(zBuf), zFormat, ap);
3c57fe6
 }
3c57fe6
 
3c57fe6
 /*
3c57fe6
diff -up sqlite-2.8.17/src/select.c.suse sqlite-2.8.17/src/select.c
3c57fe6
--- sqlite-2.8.17/src/select.c.suse	2019-04-10 14:33:55.340435617 -0400
3c57fe6
+++ sqlite-2.8.17/src/select.c	2019-04-10 14:35:16.170605054 -0400
3c57fe6
@@ -121,7 +121,7 @@ int sqliteJoinType(Parse *pParse, Token
3c57fe6
     if( pB==0 ){ pB = &dummy; zSp1 = 0; }
3c57fe6
     if( pC==0 ){ pC = &dummy; zSp2 = 0; }
3c57fe6
     sqliteSetNString(&pParse->zErrMsg, "unknown or unsupported join type: ", 0,
3c57fe6
-       pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, 0);
3c57fe6
+       pA->z, pA->n, zSp1, 1, pB->z, pB->n, zSp2, 1, pC->z, pC->n, (char*)0);
3c57fe6
     pParse->nErr++;
3c57fe6
     jointype = JT_INNER;
3c57fe6
   }else if( jointype & JT_RIGHT ){
3c57fe6
@@ -744,7 +744,7 @@ static void generateColumnNames(
3c57fe6
  
3c57fe6
         zTab = pTabList->a[j].zAlias;
3c57fe6
         if( fullNames || zTab==0 ) zTab = pTab->zName;
3c57fe6
-        sqliteSetString(&zName, zTab, ".", zCol, 0);
3c57fe6
+        sqliteSetString(&zName, zTab, ".", zCol, (char*)0);
3c57fe6
         sqliteVdbeOp3(v, OP_ColumnName, i, p2, zName, P3_DYNAMIC);
3c57fe6
       }else{
3c57fe6
         sqliteVdbeOp3(v, OP_ColumnName, i, p2, zCol, 0);
3c57fe6
@@ -809,19 +809,19 @@ Table *sqliteResultSetOfSelect(Parse *pP
3c57fe6
     }else if( (p=pEList->a[i].pExpr)->op==TK_DOT 
3c57fe6
                && (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){
3c57fe6
       int cnt;
3c57fe6
-      sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, 0);
3c57fe6
+      sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, (char*)0);
3c57fe6
       for(j=cnt=0; j
3c57fe6
         if( sqliteStrICmp(aCol[j].zName, aCol[i].zName)==0 ){
3c57fe6
           int n;
3c57fe6
           char zBuf[30];
3c57fe6
           sprintf(zBuf,"_%d",++cnt);
3c57fe6
           n = strlen(zBuf);
3c57fe6
-          sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n,0);
3c57fe6
+          sqliteSetNString(&aCol[i].zName, pR->token.z, pR->token.n, zBuf, n, (char*)0);
3c57fe6
           j = -1;
3c57fe6
         }
3c57fe6
       }
3c57fe6
     }else if( p->span.z && p->span.z[0] ){
3c57fe6
-      sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0);
3c57fe6
+      sqliteSetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, (char*)0);
3c57fe6
     }else{
3c57fe6
       char zBuf[30];
3c57fe6
       sprintf(zBuf, "column%d", i+1);
3c57fe6
@@ -879,7 +879,7 @@ static int fillInColumnList(Parse *pPars
3c57fe6
         char zFakeName[60];
3c57fe6
         sprintf(zFakeName, "sqlite_subquery_%p_",
3c57fe6
            (void*)pTabList->a[i].pSelect);
3c57fe6
-        sqliteSetString(&pTabList->a[i].zAlias, zFakeName, 0);
3c57fe6
+        sqliteSetString(&pTabList->a[i].zAlias, zFakeName, (char*)0);
3c57fe6
       }
3c57fe6
       pTabList->a[i].pTab = pTab = 
3c57fe6
         sqliteResultSetOfSelect(pParse, pTabList->a[i].zAlias,
3c57fe6
@@ -1003,7 +1003,7 @@ static int fillInColumnList(Parse *pPars
3c57fe6
               pLeft->token.z = zTabName;
3c57fe6
               pLeft->token.n = strlen(zTabName);
3c57fe6
               pLeft->token.dyn = 0;
3c57fe6
-              sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, 0);
3c57fe6
+              sqliteSetString((char**)&pExpr->span.z, zTabName, ".", zName, (char*)0);
3c57fe6
               pExpr->span.n = strlen(pExpr->span.z);
3c57fe6
               pExpr->span.dyn = 1;
3c57fe6
               pExpr->token.z = 0;
3c57fe6
diff -up sqlite-2.8.17/src/tokenize.c.suse sqlite-2.8.17/src/tokenize.c
3c57fe6
--- sqlite-2.8.17/src/tokenize.c.suse	2019-04-10 14:35:30.217290528 -0400
3c57fe6
+++ sqlite-2.8.17/src/tokenize.c	2019-04-10 14:35:41.641034104 -0400
3c57fe6
@@ -434,7 +434,7 @@ int sqliteRunParser(Parse *pParse, const
3c57fe6
       }
3c57fe6
       case TK_ILLEGAL: {
3c57fe6
         sqliteSetNString(pzErrMsg, "unrecognized token: \"", -1, 
3c57fe6
-           pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, 0);
3c57fe6
+           pParse->sLastToken.z, pParse->sLastToken.n, "\"", 1, (char*)0);
3c57fe6
         nErr++;
3c57fe6
         goto abort_parse;
3c57fe6
       }
3c57fe6
diff -up sqlite-2.8.17/src/vdbe.c.suse sqlite-2.8.17/src/vdbe.c
3c57fe6
--- sqlite-2.8.17/src/vdbe.c.suse	2019-04-10 14:35:48.752874467 -0400
3c57fe6
+++ sqlite-2.8.17/src/vdbe.c	2019-04-10 14:36:13.433320479 -0400
3c57fe6
@@ -114,7 +114,7 @@ int sqlite_step(
3c57fe6
   sqlite *db;
3c57fe6
   int rc;
3c57fe6
 
3c57fe6
-  if( p->magic!=VDBE_MAGIC_RUN ){
3c57fe6
+  if( !p || p->magic!=VDBE_MAGIC_RUN ){
3c57fe6
     return SQLITE_MISUSE;
3c57fe6
   }
3c57fe6
   db = p->db;