[Freeswitch-svn] [commit] r7105 - in freeswitch/trunk: libs/sqlite/src src

Freeswitch SVN anthm at freeswitch.org
Sat Jan 5 20:10:38 EST 2008


Author: anthm
Date: Sat Jan  5 20:10:37 2008
New Revision: 7105

Modified:
   freeswitch/trunk/libs/sqlite/src/sqliteInt.h
   freeswitch/trunk/libs/sqlite/src/util.c
   freeswitch/trunk/libs/sqlite/src/vdbefifo.c
   freeswitch/trunk/src/switch_core.c

Log:
BSD fixes, thanks jontow for the use of your box

Modified: freeswitch/trunk/libs/sqlite/src/sqliteInt.h
==============================================================================
--- freeswitch/trunk/libs/sqlite/src/sqliteInt.h	(original)
+++ freeswitch/trunk/libs/sqlite/src/sqliteInt.h	Sat Jan  5 20:10:37 2008
@@ -281,20 +281,26 @@
 	return z;
 }
 
+static inline char *strndup_lite(const char *s, size_t n)
+{
+	char *dup = malloc(n+1);
+	assert(dup);
+	memcpy(dup, s, n);
+	*(dup+n) = '\0';
+	return dup;
+}
 
 #define ENTER_MALLOC 0
 #define sqliteMalloc(x)          zmalloc(x)//sqlite3Malloc(x,1)
 #define sqliteMallocRaw(x)       malloc(x)//sqlite3MallocRaw(x,1)
 #define sqliteRealloc(x,y)       realloc(x, y)//sqlite3Realloc(x,y)
 #define sqliteStrDup(x)          strdup(x)//sqlite3StrDup(x)
-#define sqliteStrNDup(x,y)       sqlite3StrNDup(x,y)
-
+#define sqliteStrNDup(x,y)       strndup_lite(x,y) //sqlite3StrNDup(x,y)
 #define sqliteReallocOrFree(x,y) sqlite3ReallocOrFree(x,y)
 
 #endif
 
-
-#define sqliteFree(x)          if (x) { free((void *)x); x = NULL; } //sqlite3FreeX(x)
+#define sqliteFree(x)          if (x) { free((void *)x); x = NULL;} //sqlite3FreeX(x)
 #define sqliteAllocSize(x)     sqlite3AllocSize(x)
 
 

Modified: freeswitch/trunk/libs/sqlite/src/util.c
==============================================================================
--- freeswitch/trunk/libs/sqlite/src/util.c	(original)
+++ freeswitch/trunk/libs/sqlite/src/util.c	Sat Jan  5 20:10:37 2008
@@ -729,7 +729,7 @@
 char *sqlite3StrNDup(const char *z, int n){
   char *zNew;
   if( z==0 ) return 0;
-  zNew = sqliteMallocRaw(n+1);
+  zNew = sqlite3MallocRaw(n+1, 1);
   if( zNew ){
     memcpy(zNew, z, n);
     zNew[n] = 0;

Modified: freeswitch/trunk/libs/sqlite/src/vdbefifo.c
==============================================================================
--- freeswitch/trunk/libs/sqlite/src/vdbefifo.c	(original)
+++ freeswitch/trunk/libs/sqlite/src/vdbefifo.c	Sat Jan  5 20:10:37 2008
@@ -89,7 +89,7 @@
     pFifo->pFirst = pPage->pNext;
     sqliteFree(pPage);
     if( pFifo->nEntry==0 ){
-      assert( pFifo->pLast==pPage );
+		//assert( pFifo->pLast==pPage );
       pFifo->pLast = 0;
     }else{
       assert( pFifo->pFirst!=0 );

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Sat Jan  5 20:10:37 2008
@@ -705,10 +705,19 @@
 	{
 		struct rlimit rlp;
 
+		/* 
+		   Setting the stack size on FreeBSD results in an instant crash.
+		 
+		   If anyone knows how to fix this,
+		   feel free to submit a patch to http://jira.freeswitch.org 
+		*/
+
+#ifndef __FreeBSD__
 		memset(&rlp, 0, sizeof(rlp));
 		rlp.rlim_cur = SWITCH_THREAD_STACKSIZE;
 		rlp.rlim_max = SWITCH_THREAD_STACKSIZE;
 		setrlimit(RLIMIT_STACK, &rlp);
+#endif
 
 		memset(&rlp, 0, sizeof(rlp));
 		rlp.rlim_cur = 999999;



More information about the Freeswitch-svn mailing list