mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
Merge OSX compatibility patch (bug #1940)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -203,7 +203,7 @@ static void
|
|||||||
packdate (unsigned char *o, time_t w)
|
packdate (unsigned char *o, time_t w)
|
||||||
{
|
{
|
||||||
struct tm *t = localtime (&w);
|
struct tm *t = localtime (&w);
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||||
int z = - t->tm_gmtoff / 3600 / 15;
|
int z = - t->tm_gmtoff / 3600 / 15;
|
||||||
#else
|
#else
|
||||||
int z = timezone / 3600 / 15;
|
int z = timezone / 3600 / 15;
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
ARCH=$(PROC)
|
ARCH=$(PROC)
|
||||||
|
ifeq (${OSARCH},Darwin)
|
||||||
|
CFLAGS+=-Wall -Werror -fPIC -O3 -funroll-loops -fomit-frame-pointer
|
||||||
|
else
|
||||||
CFLAGS+=-Wall -Werror -fPIC -O3 -march=$(ARCH) -funroll-loops -fomit-frame-pointer
|
CFLAGS+=-Wall -Werror -fPIC -O3 -march=$(ARCH) -funroll-loops -fomit-frame-pointer
|
||||||
|
endif
|
||||||
LIB=libilbc.a
|
LIB=libilbc.a
|
||||||
|
|
||||||
OBJS= anaFilter.o iCBSearch.o packing.o \
|
OBJS= anaFilter.o iCBSearch.o packing.o \
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
|
static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -47,7 +48,6 @@ static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
|
|||||||
#include <db.h>
|
#include <db.h>
|
||||||
#include "btree.h"
|
#include "btree.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
/*
|
/*
|
||||||
* BT_DUMP -- Dump the tree
|
* BT_DUMP -- Dump the tree
|
||||||
*
|
*
|
||||||
|
@@ -50,6 +50,8 @@ static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94";
|
|||||||
#define __MPOOLINTERFACE_PRIVATE
|
#define __MPOOLINTERFACE_PRIVATE
|
||||||
#include <mpool.h>
|
#include <mpool.h>
|
||||||
|
|
||||||
|
#undef __APPLE__
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#define mpool_open __mpool_open
|
#define mpool_open __mpool_open
|
||||||
#define mpool_filter __mpool_filter
|
#define mpool_filter __mpool_filter
|
||||||
@@ -311,6 +313,8 @@ mpool_sync(mp)
|
|||||||
return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
|
return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define __APPLE__
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#undef mpool_open
|
#undef mpool_open
|
||||||
#undef mpool_filter
|
#undef mpool_filter
|
||||||
|
5
utils.c
5
utils.c
@@ -18,7 +18,7 @@
|
|||||||
static char base64[64];
|
static char base64[64];
|
||||||
static char b2a[256];
|
static char b2a[256];
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||||
|
|
||||||
/* duh? ERANGE value copied from web... */
|
/* duh? ERANGE value copied from web... */
|
||||||
#define ERANGE 34
|
#define ERANGE 34
|
||||||
@@ -190,13 +190,11 @@ int test_for_thread_safety(void)
|
|||||||
ast_mutex_lock(&test_lock);
|
ast_mutex_lock(&test_lock);
|
||||||
lock_count += 1;
|
lock_count += 1;
|
||||||
pthread_create(&test_thread, NULL, test_thread_body, NULL);
|
pthread_create(&test_thread, NULL, test_thread_body, NULL);
|
||||||
pthread_yield();
|
|
||||||
usleep(100);
|
usleep(100);
|
||||||
if (lock_count != 2)
|
if (lock_count != 2)
|
||||||
test_errors++;
|
test_errors++;
|
||||||
ast_mutex_unlock(&test_lock);
|
ast_mutex_unlock(&test_lock);
|
||||||
lock_count -= 1;
|
lock_count -= 1;
|
||||||
pthread_yield();
|
|
||||||
usleep(100);
|
usleep(100);
|
||||||
if (lock_count != 1)
|
if (lock_count != 1)
|
||||||
test_errors++;
|
test_errors++;
|
||||||
@@ -205,7 +203,6 @@ int test_for_thread_safety(void)
|
|||||||
if (lock_count != 0)
|
if (lock_count != 0)
|
||||||
test_errors++;
|
test_errors++;
|
||||||
ast_mutex_unlock(&test_lock2);
|
ast_mutex_unlock(&test_lock2);
|
||||||
pthread_yield();
|
|
||||||
usleep(100);
|
usleep(100);
|
||||||
if (lock_count != 0)
|
if (lock_count != 0)
|
||||||
test_errors++;
|
test_errors++;
|
||||||
|
Reference in New Issue
Block a user