On Tue, Aug 21, 2012 at 5:54 PM, Dwayne Litzenberger <dl...@dropbox.com> wrote:
> Please apply the attached patch against the latest trunk (45cdc32f1e),
> which fixes this bug.

It looks like the mailman archives stripped the patch, so here it is
again, as text:

commit adf442e047fcf8523b43ff975be872a36e3d5b40
Author: Dwayne Litzenberger <dl...@dropbox.com>
Date:   Tue Aug 21 14:59:05 2012 -0700

    Don't try to use OSAtomicCompareAndSwapPtrBarrier when building
for Mac OS X 10.4 and earlier.

    OSAtomicCompareAndSwapPtrBarrier was introduced in Mac OS X 10.5,
so we get a
    dyld error when starting on 10.4 if we build using a newer SDK.

diff --git a/src/mem1.c b/src/mem1.c
index 3578496..c42db01 100644
--- a/src/mem1.c
+++ b/src/mem1.c
@@ -68,6 +68,7 @@
 #include <sys/sysctl.h>
 #include <malloc/malloc.h>
 #include <libkern/OSAtomic.h>
+#include <AvailabilityMacros.h>
 static malloc_zone_t* _sqliteZone_;
 #define SQLITE_MALLOC(x) malloc_zone_malloc(_sqliteZone_, (x))
 #define SQLITE_FREE(x) malloc_zone_free(_sqliteZone_, (x));
@@ -235,8 +236,16 @@ static int sqlite3MemInit(void *NotUsed){
     malloc_zone_t* newzone = malloc_create_zone(4096, 0);
     malloc_set_zone_name(newzone, "Sqlite_Heap");
     do{
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
       success = OSAtomicCompareAndSwapPtrBarrier(NULL, newzone,
                                  (void * volatile *)&_sqliteZone_);
+#elif defined(__LP64__)
+      success = OSAtomicCompareAndSwap64Barrier((int64_t)NULL,
(int64_t)newzone,
+                                 (int64_t volatile *)&_sqliteZone_);
+#else
+      success = OSAtomicCompareAndSwap32Barrier((int32_t)NULL,
(int32_t)newzone,
+                                 (int32_t volatile *)&_sqliteZone_);
+#endif
     }while(!_sqliteZone_);
     if( !success ){
       /* somebody registered a zone first */
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to