Make check-in (5356) compatible with builds that do not enable memory
management.  Remove unnecessary code from main.c.  Add out-of-memory
tests for sqlite3_complete16(). (CVS 5357)

FossilOrigin-Name: 28f8b6bfcc3e169f8a54a6681395f2c85bf99cab
diff --git a/src/main.c b/src/main.c
index 5fb9c22..5796bc3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.468 2008/07/07 17:53:08 drh Exp $
+** $Id: main.c,v 1.469 2008/07/07 19:52:10 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -612,19 +612,17 @@
   int (*xProgress)(void*), 
   void *pArg
 ){
-  if( sqlite3SafetyCheckOk(db) ){
-    sqlite3_mutex_enter(db->mutex);
-    if( nOps>0 ){
-      db->xProgress = xProgress;
-      db->nProgressOps = nOps;
-      db->pProgressArg = pArg;
-    }else{
-      db->xProgress = 0;
-      db->nProgressOps = 0;
-      db->pProgressArg = 0;
-    }
-    sqlite3_mutex_leave(db->mutex);
+  sqlite3_mutex_enter(db->mutex);
+  if( nOps>0 ){
+    db->xProgress = xProgress;
+    db->nProgressOps = nOps;
+    db->pProgressArg = pArg;
+  }else{
+    db->xProgress = 0;
+    db->nProgressOps = 0;
+    db->pProgressArg = 0;
   }
+  sqlite3_mutex_leave(db->mutex);
 }
 #endif
 
@@ -647,9 +645,7 @@
 ** Cause any pending operation to stop at its earliest opportunity.
 */
 void sqlite3_interrupt(sqlite3 *db){
-  if( sqlite3SafetyCheckOk(db) ){
-    db->u1.isInterrupted = 1;
-  }
+  db->u1.isInterrupted = 1;
 }
 
 
diff --git a/src/pager.c b/src/pager.c
index 755e279..85be7ba 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.462 2008/07/07 18:42:41 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.463 2008/07/07 19:52:10 drh Exp $
 */
 #ifndef SQLITE_OMIT_DISKIO
 #include "sqliteInt.h"
@@ -2651,9 +2651,11 @@
       ppPg = &pPg->pNextAll;
     }else{
       *ppPg = pPg->pNextAll;
+#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
       if( *ppPg ){
         (*ppPg)->pPrevAll = pPg->pPrevAll;
       }
+#endif
       IOTRACE(("PGFREE %p %d\n", pPager, pPg->pgno));
       PAGER_INCR(sqlite3_pager_pgfree_count);
       unlinkPage(pPg);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 9bca7eb..916e84d 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -30,7 +30,7 @@
 ** the version number) and changes its name to "sqlite3.h" as
 ** part of the build process.
 **
-** @(#) $Id: sqlite.h.in,v 1.363 2008/07/07 17:53:08 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.364 2008/07/07 19:52:10 drh Exp $
 */
 #ifndef _SQLITE3_H_
 #define _SQLITE3_H_
@@ -1405,11 +1405,16 @@
 **
 ** INVARIANTS:
 **
-** {F10511} The sqlite3_complete() and sqlite3_complete16() functions
-**          return true (non-zero) if and only if the last non-whitespace
+** {F10511} A successful evaluation of [sqlite3_complete()] or
+**          [sqlite3_complete16()] functions shall
+**          return a numeric 1 if and only if the last non-whitespace
 **          token in their input is a semicolon that is not in between
 **          the BEGIN and END of a CREATE TRIGGER statement.
 **
+** {F10512} If a memory allocation error occurs during an invocation
+**          of [sqlite3_complete()] or [sqlite3_complete16()] then the
+**          routine shall return [SQLITE_NOMEM].
+**
 ** LIMITATIONS:
 **
 ** {A10512} The input to [sqlite3_complete()] must be a zero-terminated