Additional refinements on the amalgamation:  Give a couple of constants
file scope and add the SQLITE_API prefix to some interfaces that need it.
Ticket #2554. (CVS 4199)

FossilOrigin-Name: c09ec102c4f62e492dd3676ef0aa1a183d6ce3b3
diff --git a/src/malloc.c b/src/malloc.c
index 2ae3a55..8a99332 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -12,7 +12,7 @@
 ** Memory allocation functions used throughout sqlite.
 **
 **
-** $Id: malloc.c,v 1.3 2007/06/15 20:29:20 drh Exp $
+** $Id: malloc.c,v 1.4 2007/08/08 01:04:52 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -792,10 +792,10 @@
 ** then the connection error-code (the value returned by sqlite3_errcode())
 ** is set to SQLITE_NOMEM.
 */
-int sqlite3_mallocHasFailed = 0;
+int sqlite3MallocHasFailed = 0;
 int sqlite3ApiExit(sqlite3* db, int rc){
   if( sqlite3MallocFailed() ){
-    sqlite3_mallocHasFailed = 0;
+    sqlite3MallocHasFailed = 0;
     sqlite3OsLeaveMutex();
     sqlite3Error(db, SQLITE_NOMEM, 0);
     rc = SQLITE_NOMEM;
@@ -809,8 +809,8 @@
 void sqlite3FailedMalloc(){
   if( !sqlite3MallocFailed() ){
     sqlite3OsEnterMutex();
-    assert( sqlite3_mallocHasFailed==0 );
-    sqlite3_mallocHasFailed = 1;
+    assert( sqlite3MallocHasFailed==0 );
+    sqlite3MallocHasFailed = 1;
   }
 }
 
diff --git a/src/os_common.h b/src/os_common.h
index ba52314..4294dd7 100644
--- a/src/os_common.h
+++ b/src/os_common.h
@@ -36,8 +36,8 @@
 unsigned int sqlite3_pending_byte = 0x40000000;
 #endif
 
+#ifdef SQLITE_TEST
 int sqlite3_os_trace = 0;
-#ifdef SQLITE_DEBUG
 #define OSTRACE1(X)         if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
 #define OSTRACE2(X,Y)       if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
 #define OSTRACE3(X,Y,Z)     if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index dfb953e..f2868b5 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.583 2007/08/07 17:13:04 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.584 2007/08/08 01:04:52 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -256,15 +256,15 @@
 
 #endif
 
-/* Variable sqlite3_mallocHasFailed is set to true after a malloc() 
+/* Variable sqlite3MallocHasFailed is set to true after a malloc() 
 ** failure occurs. 
 **
 ** The sqlite3MallocFailed() macro returns true if a malloc has failed
 ** in this thread since the last call to sqlite3ApiExit(), or false 
 ** otherwise.
 */
-extern int sqlite3_mallocHasFailed;
-#define sqlite3MallocFailed() (sqlite3_mallocHasFailed && sqlite3OsInMutex(1))
+extern int sqlite3MallocHasFailed;
+#define sqlite3MallocFailed() (sqlite3MallocHasFailed && sqlite3OsInMutex(1))
 
 #define sqliteFree(x)          sqlite3FreeX(x)
 #define sqliteAllocSize(x)     sqlite3AllocSize(x)