提交 5bcc83f3 authored 作者: Michael Jerris's avatar Michael Jerris

solaris porting

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4984 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 2266c9b8
...@@ -4,7 +4,7 @@ AUTOMAKE_OPTS= gnu ...@@ -4,7 +4,7 @@ AUTOMAKE_OPTS= gnu
NAME=libgsm NAME=libgsm
AM_CC=gcc AM_CC=gcc
AM_CFLAGS = -I./inc -DNeedFunctionPrototypes=1 -funroll-loops -fPIC -DSASR -DNDEBUG -DWAV49 AM_CFLAGS = -I./inc -DNeedFunctionPrototypes=1 -fPIC -DSASR -DNDEBUG -DWAV49
AM_CPPFLAGS = $(AM_CFLAGS) AM_CPPFLAGS = $(AM_CFLAGS)
lib_LTLIBRARIES = libgsm.la lib_LTLIBRARIES = libgsm.la
......
...@@ -103,7 +103,7 @@ static void UnlockArena( void ) ...@@ -103,7 +103,7 @@ static void UnlockArena( void )
PR_Unlock( arenaLock ); PR_Unlock( arenaLock );
return; return;
} /* end UnlockArena() */ } /* end UnlockArena() */
#if 0
PR_IMPLEMENT(void) PL_InitArenaPool( PR_IMPLEMENT(void) PL_InitArenaPool(
PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align) PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align)
{ {
...@@ -126,7 +126,7 @@ PR_IMPLEMENT(void) PL_InitArenaPool( ...@@ -126,7 +126,7 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
arena_stats_list = &pool->stats; arena_stats_list = &pool->stats;
#endif #endif
} }
#endif
/* /*
** PL_ArenaAllocate() -- allocate space from an arena pool ** PL_ArenaAllocate() -- allocate space from an arena pool
......
...@@ -70,8 +70,6 @@ PL_HashTableRawAdd; ...@@ -70,8 +70,6 @@ PL_HashTableRawAdd;
PL_HashTableRawLookup; PL_HashTableRawLookup;
PL_HashTableRawRemove; PL_HashTableRawRemove;
PL_HashTableRemove; PL_HashTableRemove;
PL_InitArenaPool;
PL_NewHashTable;
libVersionPoint; libVersionPoint;
;+ local: *; ;+ local: *;
;+}; ;+};
......
...@@ -107,7 +107,7 @@ static PLHashAllocOps defaultHashAllocOps = { ...@@ -107,7 +107,7 @@ static PLHashAllocOps defaultHashAllocOps = {
DefaultAllocTable, DefaultFreeTable, DefaultAllocTable, DefaultFreeTable,
DefaultAllocEntry, DefaultFreeEntry DefaultAllocEntry, DefaultFreeEntry
}; };
#if 0
PR_IMPLEMENT(PLHashTable *) PR_IMPLEMENT(PLHashTable *)
PL_NewHashTable(PRUint32 n, PLHashFunction keyHash, PL_NewHashTable(PRUint32 n, PLHashFunction keyHash,
PLHashComparator keyCompare, PLHashComparator valueCompare, PLHashComparator keyCompare, PLHashComparator valueCompare,
...@@ -153,7 +153,7 @@ PL_NewHashTable(PRUint32 n, PLHashFunction keyHash, ...@@ -153,7 +153,7 @@ PL_NewHashTable(PRUint32 n, PLHashFunction keyHash,
ht->allocPriv = allocPriv; ht->allocPriv = allocPriv;
return ht; return ht;
} }
#endif
PR_IMPLEMENT(void) PR_IMPLEMENT(void)
PL_HashTableDestroy(PLHashTable *ht) PL_HashTableDestroy(PLHashTable *ht)
{ {
......
...@@ -55,9 +55,7 @@ PL_Base64Decode; ...@@ -55,9 +55,7 @@ PL_Base64Decode;
PL_Base64Encode; PL_Base64Encode;
PL_CreateOptState; PL_CreateOptState;
PL_DestroyOptState; PL_DestroyOptState;
PL_FPrintError;
PL_GetNextOpt; PL_GetNextOpt;
PL_PrintError;
PL_strcasecmp; PL_strcasecmp;
PL_strcaserstr; PL_strcaserstr;
PL_strcasestr; PL_strcasestr;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "prprf.h" #include "prprf.h"
#include "prerror.h" #include "prerror.h"
#if 0
PR_IMPLEMENT(void) PL_FPrintError(PRFileDesc *fd, const char *msg) PR_IMPLEMENT(void) PL_FPrintError(PRFileDesc *fd, const char *msg)
{ {
static const char *tags[] = static const char *tags[] =
...@@ -148,7 +149,7 @@ PR_IMPLEMENT(void) PL_PrintError(const char *msg) ...@@ -148,7 +149,7 @@ PR_IMPLEMENT(void) PL_PrintError(const char *msg)
if (NULL == fd) fd = PR_GetSpecialFD(PR_StandardError); if (NULL == fd) fd = PR_GetSpecialFD(PR_StandardError);
PL_FPrintError(fd, msg); PL_FPrintError(fd, msg);
} /* PL_PrintError */ } /* PL_PrintError */
#endif
#if defined(WIN16) #if defined(WIN16)
/* /*
** libmain() is a required function for win16 ** libmain() is a required function for win16
......
...@@ -52,11 +52,7 @@ ...@@ -52,11 +52,7 @@
;+ global: ;+ global:
LIBRARY nspr4 ;- LIBRARY nspr4 ;-
EXPORTS ;- EXPORTS ;-
LL_MaxInt;
LL_MinInt;
LL_Zero;
PR_Abort; PR_Abort;
PR_AddToCounter;
PR_Accept; PR_Accept;
PR_AcceptRead; PR_AcceptRead;
PR_Access; PR_Access;
...@@ -67,25 +63,16 @@ EXPORTS ;- ...@@ -67,25 +63,16 @@ EXPORTS ;-
PR_AtomicDecrement; PR_AtomicDecrement;
PR_AtomicIncrement; PR_AtomicIncrement;
PR_AtomicSet; PR_AtomicSet;
PR_AttachSharedMemory;
PR_AttachThread; PR_AttachThread;
PR_Available; PR_Available;
PR_Available64; PR_Available64;
PR_Bind; PR_Bind;
PR_BlockClockInterrupts; PR_BlockClockInterrupts;
PR_BlockInterrupt; PR_BlockInterrupt;
PR_CEnterMonitor;
PR_CExitMonitor;
PR_CNotify;
PR_CNotifyAll;
PR_CSetOnMonitorRecycle;
PR_CWait;
PR_CallOnce; PR_CallOnce;
PR_Calloc; PR_Calloc;
PR_CancelJob;
PR_CancelWaitFileDesc; PR_CancelWaitFileDesc;
PR_CancelWaitGroup; PR_CancelWaitGroup;
PR_CeilingLog2;
PR_ChangeFileDescNativeHandle; PR_ChangeFileDescNativeHandle;
PR_Cleanup; PR_Cleanup;
PR_ClearInterrupt; PR_ClearInterrupt;
...@@ -94,11 +81,8 @@ EXPORTS ;- ...@@ -94,11 +81,8 @@ EXPORTS ;-
PR_CloseDir; PR_CloseDir;
PR_CloseFileMap; PR_CloseFileMap;
PR_CloseSemaphore; PR_CloseSemaphore;
PR_CloseSharedMemory;
PR_Connect; PR_Connect;
PR_CreateCounter;
PR_ConvertIPv4AddrToIPv6; PR_ConvertIPv4AddrToIPv6;
PR_CreateAlarm;
PR_CreateFileMap; PR_CreateFileMap;
PR_CreateIOLayerStub; PR_CreateIOLayerStub;
PR_CreateOrderedLock; PR_CreateOrderedLock;
...@@ -110,30 +94,20 @@ EXPORTS ;- ...@@ -110,30 +94,20 @@ EXPORTS ;-
PR_CreateStack; PR_CreateStack;
PR_CreateThread; PR_CreateThread;
PR_CreateThreadGCAble; PR_CreateThreadGCAble;
PR_CreateTrace;
PR_CreateThreadPool;
PR_DecrementCounter;
PR_CreateWaitGroup; PR_CreateWaitGroup;
PR_Delete; PR_Delete;
PR_DeleteSemaphore; PR_DeleteSemaphore;
PR_DeleteSharedMemory;
PR_DestroyAlarm;
PR_DestroyCounter;
PR_DestroyCondVar; PR_DestroyCondVar;
PR_DestroyLock; PR_DestroyLock;
PR_DestroyMWaitEnumerator; PR_DestroyMWaitEnumerator;
PR_DestroyOrderedLock; PR_DestroyOrderedLock;
PR_DestroyMonitor; PR_DestroyMonitor;
PR_DestroyPollableEvent;
PR_DestroyProcessAttr; PR_DestroyProcessAttr;
PR_DestroyRWLock;
PR_DestroySem; PR_DestroySem;
PR_DestroySocketPollFd; PR_DestroySocketPollFd;
PR_DestroyTrace;
PR_DestroyStack; PR_DestroyStack;
PR_DestroyWaitGroup; PR_DestroyWaitGroup;
PR_DetachProcess; PR_DetachProcess;
PR_DetachSharedMemory;
PR_DetachThread; PR_DetachThread;
PR_DisableClockInterrupts; PR_DisableClockInterrupts;
PR_EnableClockInterrupts; PR_EnableClockInterrupts;
...@@ -141,14 +115,8 @@ EXPORTS ;- ...@@ -141,14 +115,8 @@ EXPORTS ;-
PR_EnumerateHostEnt; PR_EnumerateHostEnt;
PR_EnumerateThreads; PR_EnumerateThreads;
PR_EnumerateWaitGroup; PR_EnumerateWaitGroup;
PR_ErrorInstallCallback;
PR_ErrorInstallTable;
PR_ErrorLanguages;
PR_ErrorToName;
PR_ErrorToString;
PR_ExitMonitor; PR_ExitMonitor;
PR_ExplodeTime; PR_ExplodeTime;
PR_ExportFileMapAsString;
PR_FD_CLR; PR_FD_CLR;
PR_FD_ISSET; PR_FD_ISSET;
PR_FD_NCLR; PR_FD_NCLR;
...@@ -157,44 +125,25 @@ EXPORTS ;- ...@@ -157,44 +125,25 @@ EXPORTS ;-
PR_FD_SET; PR_FD_SET;
PR_FD_ZERO; PR_FD_ZERO;
PR_FileDesc2NativeHandle; PR_FileDesc2NativeHandle;
PR_FindSymbol;
PR_FindSymbolAndLibrary;
PR_FloorLog2;
PR_FormatTime; PR_FormatTime;
PR_FindNextCounterQname;
PR_FindNextCounterRname;
PR_FindNextTraceQname;
PR_FindNextTraceRname;
PR_FormatTimeUSEnglish; PR_FormatTimeUSEnglish;
PR_Free; PR_Free;
PR_FreeLibraryName;
PR_GMTParameters; PR_GMTParameters;
PR_GetConnectStatus; PR_GetConnectStatus;
PR_GetCurrentThread; PR_GetCurrentThread;
PR_GetDefaultIOMethods; PR_GetDefaultIOMethods;
PR_GetDescType; PR_GetDescType;
PR_GetDirectorySeparator;
PR_GetCounter;
PR_GetCounterHandleFromName;
PR_GetCounterNameFromHandle;
PR_GetDirectorySepartor;
PR_GetEnv;
PR_GetError; PR_GetError;
PR_GetErrorText; PR_GetErrorText;
PR_GetErrorTextLength; PR_GetErrorTextLength;
PR_GetFileInfo; PR_GetFileInfo;
PR_GetFileInfo64; PR_GetFileInfo64;
PR_GetFileMethods; PR_GetFileMethods;
PR_GetGCRegisters;
PR_GetHostByAddr; PR_GetHostByAddr;
PR_GetHostByName; PR_GetHostByName;
PR_GetIPNodeByName; PR_GetIPNodeByName;
PR_GetIdentitiesLayer; PR_GetIdentitiesLayer;
PR_GetInheritedFD;
PR_GetInheritedFileMap;
PR_GetLayersIdentity; PR_GetLayersIdentity;
PR_GetLibraryName;
PR_GetLibraryPath;
PR_GetMonitorEntryCount; PR_GetMonitorEntryCount;
PR_GetNameForIdentity; PR_GetNameForIdentity;
PR_GetOSError; PR_GetOSError;
...@@ -206,14 +155,11 @@ EXPORTS ;- ...@@ -206,14 +155,11 @@ EXPORTS ;-
PR_GetPipeMethods; PR_GetPipeMethods;
PR_GetProtoByName; PR_GetProtoByName;
PR_GetProtoByNumber; PR_GetProtoByNumber;
PR_GetRandomNoise;
PR_GetSP; PR_GetSP;
PR_GetSockName; PR_GetSockName;
PR_GetSocketOption; PR_GetSocketOption;
PR_GetSpecialFD; PR_GetSpecialFD;
PR_GetStackSpaceLeft;
PR_GetSysfdTableMax; PR_GetSysfdTableMax;
PR_GetSystemInfo;
PR_GetTCPMethods; PR_GetTCPMethods;
PR_GetThreadAffinityMask; PR_GetThreadAffinityMask;
PR_GetThreadID; PR_GetThreadID;
...@@ -226,13 +172,8 @@ EXPORTS ;- ...@@ -226,13 +172,8 @@ EXPORTS ;-
PR_GetUniqueIdentity; PR_GetUniqueIdentity;
PR_ImplodeTime; PR_ImplodeTime;
PR_ImportFile; PR_ImportFile;
PR_ImportFileMapFromString;
PR_ImportTCPSocket; PR_ImportTCPSocket;
PR_ImportUDPSocket; PR_ImportUDPSocket;
PR_GetTraceEntries;
PR_GetTraceHandleFromName;
PR_GetTraceNameFromHandle;
PR_GetTraceOption;
PR_Init; PR_Init;
PR_Initialize; PR_Initialize;
PR_InitializeNetAddr; PR_InitializeNetAddr;
...@@ -241,17 +182,11 @@ EXPORTS ;- ...@@ -241,17 +182,11 @@ EXPORTS ;-
PR_IntervalNow; PR_IntervalNow;
PR_IntervalToMicroseconds; PR_IntervalToMicroseconds;
PR_IntervalToMilliseconds; PR_IntervalToMilliseconds;
PR_IncrementCounter;
PR_IntervalToSeconds; PR_IntervalToSeconds;
PR_IsNetAddrType; PR_IsNetAddrType;
PR_JoinJob;
PR_JoinThread; PR_JoinThread;
PR_JoinThreadPool;
PR_KillProcess; PR_KillProcess;
PR_Listen; PR_Listen;
PR_LoadLibrary;
PR_LoadLibraryWithFlags;
PR_LoadStaticLibrary;
PR_LocalTimeParameters; PR_LocalTimeParameters;
PR_Lock; PR_Lock;
PR_LockFile; PR_LockFile;
...@@ -271,14 +206,10 @@ EXPORTS ;- ...@@ -271,14 +206,10 @@ EXPORTS ;-
PR_NewLogModule; PR_NewLogModule;
PR_NewMonitor; PR_NewMonitor;
PR_NewNamedMonitor; PR_NewNamedMonitor;
PR_NewPollableEvent;
PR_NewProcessAttr; PR_NewProcessAttr;
PR_NewRWLock;
PR_NewSem; PR_NewSem;
PR_NewTCPSocket;
PR_NewTCPSocketPair; PR_NewTCPSocketPair;
PR_NewThreadPrivateIndex; PR_NewThreadPrivateIndex;
PR_NewUDPSocket;
PR_NormalizeTime; PR_NormalizeTime;
PR_Notify; PR_Notify;
PR_NotifyAll; PR_NotifyAll;
...@@ -286,13 +217,9 @@ EXPORTS ;- ...@@ -286,13 +217,9 @@ EXPORTS ;-
PR_NotifyCondVar; PR_NotifyCondVar;
PR_Now; PR_Now;
PR_Open; PR_Open;
PR_OpenAnonFileMap;
PR_OpenDir; PR_OpenDir;
PR_OpenFile; PR_OpenFile;
PR_OpenSemaphore; PR_OpenSemaphore;
PR_OpenSharedMemory;
PR_OpenTCPSocket;
PR_OpenUDPSocket;
PR_ParseTimeString; PR_ParseTimeString;
PR_Poll; PR_Poll;
PR_PopIOLayer; PR_PopIOLayer;
...@@ -300,31 +227,18 @@ EXPORTS ;- ...@@ -300,31 +227,18 @@ EXPORTS ;-
PR_PostSemaphore; PR_PostSemaphore;
PR_ProcessAttrSetCurrentDirectory; PR_ProcessAttrSetCurrentDirectory;
PR_ProcessAttrSetInheritableFD; PR_ProcessAttrSetInheritableFD;
PR_ProcessAttrSetInheritableFileMap;
PR_ProcessAttrSetStdioRedirect; PR_ProcessAttrSetStdioRedirect;
PR_ProcessExit; PR_ProcessExit;
PR_PushIOLayer; PR_PushIOLayer;
PR_QueueJob;
PR_QueueJob_Accept;
PR_QueueJob_Connect;
PR_QueueJob_Read;
PR_QueueJob_Timer;
PR_QueueJob_Write;
PR_RWLock_Rlock;
PR_RWLock_Unlock;
PR_RWLock_Wlock;
PR_Read; PR_Read;
PR_ReadDir; PR_ReadDir;
PR_Realloc; PR_Realloc;
PR_Recv; PR_Recv;
PR_RecvFrom; PR_RecvFrom;
PR_Rename; PR_Rename;
PR_ResetAlarm;
PR_ResetProcessAttr; PR_ResetProcessAttr;
PR_ResumeAll; PR_ResumeAll;
PR_RmDir; PR_RmDir;
PR_ScanStackPointers;
PR_RecordTraceEntries;
PR_SecondsToInterval; PR_SecondsToInterval;
PR_Seek; PR_Seek;
PR_Seek64; PR_Seek64;
...@@ -332,20 +246,15 @@ EXPORTS ;- ...@@ -332,20 +246,15 @@ EXPORTS ;-
PR_Send; PR_Send;
PR_SendFile; PR_SendFile;
PR_SendTo; PR_SendTo;
PR_SetAlarm;
PR_SetConcurrency; PR_SetConcurrency;
PR_SetError; PR_SetError;
PR_SetErrorText; PR_SetErrorText;
PR_SetFDCacheSize; PR_SetFDCacheSize;
PR_SetFDInheritable; PR_SetFDInheritable;
PR_SetLibraryPath;
PR_SetLogBuffering; PR_SetLogBuffering;
PR_SetLogFile; PR_SetLogFile;
PR_SetNetAddr; PR_SetNetAddr;
PR_SetPollableEvent;
PR_SetSocketOption; PR_SetSocketOption;
PR_SetCounter;
PR_SetStdioRedirect;
PR_SetSysfdTableSize; PR_SetSysfdTableSize;
PR_SetThreadAffinityMask; PR_SetThreadAffinityMask;
PR_SetThreadDumpProc; PR_SetThreadDumpProc;
...@@ -354,9 +263,7 @@ EXPORTS ;- ...@@ -354,9 +263,7 @@ EXPORTS ;-
PR_SetThreadPrivate; PR_SetThreadPrivate;
PR_SetThreadRecycleMode; PR_SetThreadRecycleMode;
PR_Shutdown; PR_Shutdown;
PR_ShutdownThreadPool;
PR_Sleep; PR_Sleep;
PR_Socket;
PR_StackPop; PR_StackPop;
PR_StackPush; PR_StackPush;
PR_Stat; PR_Stat;
...@@ -364,22 +271,16 @@ EXPORTS ;- ...@@ -364,22 +271,16 @@ EXPORTS ;-
PR_SuspendAll; PR_SuspendAll;
PR_Sync; PR_Sync;
PR_TLockFile; PR_TLockFile;
PR_ThreadScanStackPointers;
PR_SetTraceOption;
PR_TicksPerSecond; PR_TicksPerSecond;
PR_TransmitFile; PR_TransmitFile;
PR_USPacificTimeParameters; PR_USPacificTimeParameters;
PR_UnblockClockInterrupts; PR_UnblockClockInterrupts;
PR_UnblockInterrupt; PR_UnblockInterrupt;
PR_UnloadLibrary;
PR_SubtractFromCounter;
PR_Unlock; PR_Unlock;
PR_UnlockFile; PR_UnlockFile;
PR_VersionCheck; PR_VersionCheck;
PR_Wait; PR_Wait;
PR_WaitCondVar; PR_WaitCondVar;
PR_WaitForPollableEvent;
PR_Trace;
PR_WaitProcess; PR_WaitProcess;
PR_WaitRecvReady; PR_WaitRecvReady;
PR_WaitSem; PR_WaitSem;
...@@ -388,9 +289,6 @@ EXPORTS ;- ...@@ -388,9 +289,6 @@ EXPORTS ;-
PR_Writev; PR_Writev;
PR_Yield; PR_Yield;
PR_UnlockOrderedLock; PR_UnlockOrderedLock;
PR_cnvtf;
PR_dtoa;
PR_fprintf;
PR_htonl; PR_htonl;
PR_htonll; PR_htonll;
PR_htons; PR_htons;
...@@ -401,10 +299,7 @@ EXPORTS ;- ...@@ -401,10 +299,7 @@ EXPORTS ;-
PR_smprintf_free; PR_smprintf_free;
PR_snprintf; PR_snprintf;
PR_sprintf_append; PR_sprintf_append;
PR_sscanf;
PR_strtod;
PR_sxprintf; PR_sxprintf;
PR_vfprintf;
PR_vsmprintf; PR_vsmprintf;
PR_vsnprintf; PR_vsnprintf;
PR_vsprintf_append; PR_vsprintf_append;
...@@ -433,35 +328,19 @@ EXPORTS ;- ...@@ -433,35 +328,19 @@ EXPORTS ;-
PR_CreateIOLayer; PR_CreateIOLayer;
PR_EmulateAcceptRead; PR_EmulateAcceptRead;
PR_EmulateSendFile; PR_EmulateSendFile;
PR_FindFunctionSymbol;
PR_FindFunctionSymbolAndLibrary;
PR_GetMemMapAlignment; PR_GetMemMapAlignment;
PR_GetNumberOfProcessors;
PR_ImportPipe; PR_ImportPipe;
PR_SetEnv;
;+} NSPR_4.0; ;+} NSPR_4.0;
;+ ;+
;+NSPR_4.3 { ;+NSPR_4.3 {
;+ global: ;+ global:
LL_MaxUint;
PR_CallOnceWithArg; PR_CallOnceWithArg;
PR_GetLibraryFilePathname;
;+} NSPR_4.1; ;+} NSPR_4.1;
;+ ;+
;+NSPR_4.4 {
;+ global:
PR_GetPathSeparator;
;+} NSPR_4.3;
;+
;+NSPR_4.5 { ;+NSPR_4.5 {
;+ global: ;+ global:
PR_EnumerateAddrInfo; PR_EnumerateAddrInfo;
PR_FreeAddrInfo; PR_FreeAddrInfo;
PR_GetAddrInfoByName; PR_GetAddrInfoByName;
PR_GetCanonNameFromAddrInfo; PR_GetCanonNameFromAddrInfo;
;+} NSPR_4.4; ;+} NSPR_4.3;
;+
;+NSPR_4.6 {
;+ global:
PR_GetPhysicalMemorySize;
;+} NSPR_4.5;
...@@ -236,17 +236,17 @@ enum dns_rcode { /* reply codes */ ...@@ -236,17 +236,17 @@ enum dns_rcode { /* reply codes */
DNS_R_BADTIME = 18 DNS_R_BADTIME = 18
}; };
static __inline unsigned dns_get16(dnscc_t *s) { static inline unsigned dns_get16(dnscc_t *s) {
return ((unsigned)s[0]<<8) | s[1]; return ((unsigned)s[0]<<8) | s[1];
} }
static __inline unsigned dns_get32(dnscc_t *s) { static inline unsigned dns_get32(dnscc_t *s) {
return ((unsigned)s[0]<<24) | ((unsigned)s[1]<<16) return ((unsigned)s[0]<<24) | ((unsigned)s[1]<<16)
| ((unsigned)s[2]<<8) | s[3]; | ((unsigned)s[2]<<8) | s[3];
} }
static __inline dnsc_t *dns_put16(dnsc_t *d, unsigned n) { static inline dnsc_t *dns_put16(dnsc_t *d, unsigned n) {
*d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255); return d; *d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255); return d;
} }
static __inline dnsc_t *dns_put32(dnsc_t *d, unsigned n) { static inline dnsc_t *dns_put32(dnsc_t *d, unsigned n) {
*d++ = (dnsc_t)((n >> 24) & 255); *d++ = (dnsc_t)((n >> 16) & 255); *d++ = (dnsc_t)((n >> 24) & 255); *d++ = (dnsc_t)((n >> 16) & 255);
*d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255); *d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255);
return d; return d;
......
...@@ -111,24 +111,24 @@ struct dns_query { ...@@ -111,24 +111,24 @@ struct dns_query {
/* working with dns_query lists */ /* working with dns_query lists */
static __inline void qlist_init(struct dns_qlink *list) { static inline void qlist_init(struct dns_qlink *list) {
list->next = list->prev = (struct dns_query *)list; list->next = list->prev = (struct dns_query *)list;
} }
static __inline int qlist_empty(const struct dns_qlink *list) { static inline int qlist_empty(const struct dns_qlink *list) {
return list->next == (const struct dns_query *)list ? 1 : 0; return list->next == (const struct dns_query *)list ? 1 : 0;
} }
static __inline struct dns_query *qlist_first(struct dns_qlink *list) { static inline struct dns_query *qlist_first(struct dns_qlink *list) {
return list->next == (struct dns_query *)list ? 0 : list->next; return list->next == (struct dns_query *)list ? 0 : list->next;
} }
static __inline void qlist_remove(struct dns_query *q) { static inline void qlist_remove(struct dns_query *q) {
q->dnsq_link.next->dnsq_link.prev = q->dnsq_link.prev; q->dnsq_link.next->dnsq_link.prev = q->dnsq_link.prev;
q->dnsq_link.prev->dnsq_link.next = q->dnsq_link.next; q->dnsq_link.prev->dnsq_link.next = q->dnsq_link.next;
} }
static __inline struct dns_query *qlist_pop(struct dns_qlink *list) { static inline struct dns_query *qlist_pop(struct dns_qlink *list) {
struct dns_query *q = list->next; struct dns_query *q = list->next;
if (q == (struct dns_query *)list) if (q == (struct dns_query *)list)
return NULL; return NULL;
...@@ -137,7 +137,7 @@ static __inline struct dns_query *qlist_pop(struct dns_qlink *list) { ...@@ -137,7 +137,7 @@ static __inline struct dns_query *qlist_pop(struct dns_qlink *list) {
} }
/* insert q between prev and next */ /* insert q between prev and next */
static __inline void static inline void
qlist_insert(struct dns_query *q, qlist_insert(struct dns_query *q,
struct dns_query *prev, struct dns_query *next) { struct dns_query *prev, struct dns_query *next) {
q->dnsq_link.next = next; q->dnsq_link.next = next;
...@@ -145,22 +145,22 @@ qlist_insert(struct dns_query *q, ...@@ -145,22 +145,22 @@ qlist_insert(struct dns_query *q,
prev->dnsq_link.next = next->dnsq_link.prev = q; prev->dnsq_link.next = next->dnsq_link.prev = q;
} }
static __inline void static inline void
qlist_insert_after(struct dns_query *q, struct dns_query *prev) { qlist_insert_after(struct dns_query *q, struct dns_query *prev) {
qlist_insert(q, prev, prev->dnsq_link.next); qlist_insert(q, prev, prev->dnsq_link.next);
} }
static __inline void static inline void
qlist_insert_before(struct dns_query *q, struct dns_query *next) { qlist_insert_before(struct dns_query *q, struct dns_query *next) {
qlist_insert(q, next->dnsq_link.prev, next); qlist_insert(q, next->dnsq_link.prev, next);
} }
static __inline void static inline void
qlist_add_tail(struct dns_query *q, struct dns_qlink *top) { qlist_add_tail(struct dns_query *q, struct dns_qlink *top) {
qlist_insert_before(q, (struct dns_query *)top); qlist_insert_before(q, (struct dns_query *)top);
} }
static __inline void static inline void
qlist_add_head(struct dns_query *q, struct dns_qlink *top) { qlist_add_head(struct dns_query *q, struct dns_qlink *top) {
qlist_insert_after(q, (struct dns_query *)top); qlist_insert_after(q, (struct dns_query *)top);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论