Bug 158704: the counter, ordered lock, and trace symbols should be defined

in optimized builds as well.
Modified files: prcountr.h prolock.h prtrace.h prcountr.c prolock.c
prtrace.c
This commit is contained in:
wtc%netscape.com 2003-01-03 23:09:17 +00:00
Родитель 4e5cbff56d
Коммит d221f8deb9
6 изменённых файлов: 127 добавлений и 116 удалений

Просмотреть файл

@ -116,7 +116,6 @@ typedef void * PRCounterHandle;
#define PRCOUNTER_DESC_MAX 255
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
/* -----------------------------------------------------------------------
** FUNCTION: PR_DEFINE_COUNTER() -- Define a PRCounterHandle
@ -135,8 +134,12 @@ typedef void * PRCounterHandle;
** to value.
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_INIT_COUNTER_HANDLE(handle,value)\
(handle) = (PRCounterHandle)(value)
#else
#define PR_INIT_COUNTER_HANDLE(handle,value)
#endif
/* -----------------------------------------------------------------------
** FUNCTION: PR_CreateCounter() -- Create a counter
@ -167,8 +170,12 @@ typedef void * PRCounterHandle;
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_CREATE_COUNTER(handle,qName,rName,description)\
(handle) = PR_CreateCounter((qName),(rName),(description))
#else
#define PR_CREATE_COUNTER(handle,qName,rName,description)
#endif
NSPR_API(PRCounterHandle)
PR_CreateCounter(
@ -194,7 +201,11 @@ NSPR_API(PRCounterHandle)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_DESTROY_COUNTER(handle) PR_DestroyCounter((handle))
#else
#define PR_DESTROY_COUNTER(handle)
#endif
NSPR_API(void)
PR_DestroyCounter(
@ -222,8 +233,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)\
(handle) = PR_GetCounterHandleFromName((qName),(rName))
#else
#define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)
#endif
NSPR_API(PRCounterHandle)
PR_GetCounterHandleFromName(
@ -251,8 +266,12 @@ NSPR_API(PRCounterHandle)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description)\
PR_GetCounterNameFromHandle((handle),(qName),(rName),(description))
#else
#define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description )
#endif
NSPR_API(void)
PR_GetCounterNameFromHandle(
@ -279,7 +298,11 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_INCREMENT_COUNTER(handle) PR_IncrementCounter(handle)
#else
#define PR_INCREMENT_COUNTER(handle)
#endif
NSPR_API(void)
PR_IncrementCounter(
@ -304,7 +327,11 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_DECREMENT_COUNTER(handle) PR_DecrementCounter(handle)
#else
#define PR_DECREMENT_COUNTER(handle)
#endif
NSPR_API(void)
PR_DecrementCounter(
@ -328,8 +355,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_ADD_TO_COUNTER(handle,value)\
PR_AddToCounter((handle),(value))
#else
#define PR_ADD_TO_COUNTER(handle,value)
#endif
NSPR_API(void)
PR_AddToCounter(
@ -358,8 +389,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_SUBTRACT_FROM_COUNTER(handle,value)\
PR_SubtractFromCounter((handle),(value))
#else
#define PR_SUBTRACT_FROM_COUNTER(handle,value)
#endif
NSPR_API(void)
PR_SubtractFromCounter(
@ -384,8 +419,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_GET_COUNTER(counter,handle)\
(counter) = PR_GetCounter((handle))
#else
#define PR_GET_COUNTER(counter,handle) 0
#endif
NSPR_API(PRUint32)
PR_GetCounter(
@ -412,7 +451,11 @@ NSPR_API(PRUint32)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_SET_COUNTER(handle,value) PR_SetCounter((handle),(value))
#else
#define PR_SET_COUNTER(handle,value)
#endif
NSPR_API(void)
PR_SetCounter(
@ -450,8 +493,12 @@ NSPR_API(void)
** operations may cause unpredictable results.
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
(next) = PR_FindNextCounterQname((handle))
#else
#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
#endif
NSPR_API(PRCounterHandle)
PR_FindNextCounterQname(
@ -489,8 +536,12 @@ NSPR_API(PRCounterHandle)
** operations may cause unpredictable results.
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)\
(next) = PR_FindNextCounterRname((rhandle),(qhandle))
#else
#define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)
#endif
NSPR_API(PRCounterHandle)
PR_FindNextCounterRname(
@ -498,31 +549,6 @@ NSPR_API(PRCounterHandle)
PRCounterHandle qhandle
);
#else /* ( !(defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)) */
/*
** When counters are not compiled in, provide macros that
** evaluate to No-Ops.
**
*/
#define PR_DEFINE_COUNTER(name) PRCounterHandle name
#define PR_INIT_COUNTER_HANDLE(handle,value)
#define PR_CREATE_COUNTER(handle,qName,rName,description)
#define PR_DESTROY_COUNTER(handle)
#define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)
#define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description )
#define PR_INCREMENT_COUNTER(handle)
#define PR_DECREMENT_COUNTER(handle)
#define PR_ADD_TO_COUNTER(handle,value)
#define PR_SUBTRACT_FROM_COUNTER(handle,value)
#define PR_GET_COUNTER(counter,handle) 0
#define PR_SET_COUNTER(handle,value)
#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
#define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)
#endif /* ( !(defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)) */
PR_END_EXTERN_C
#endif /* prcountr_h___ */

Просмотреть файл

@ -39,8 +39,6 @@
PR_BEGIN_EXTERN_C
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
/*
** A locking mechanism, built on the existing PRLock definiion,
** is provided that will permit applications to define a Lock
@ -80,7 +78,18 @@ PR_BEGIN_EXTERN_C
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
typedef void * PROrderedLock;
#else
/*
** Map PROrderedLock and methods onto PRLock when ordered locking
** is not compiled in.
**
*/
#include <prlock.h>
typedef PRLock PROrderedLock;
#endif
/* -----------------------------------------------------------------------
** FUNCTION: PR_CreateOrderedLock() -- Create an Ordered Lock
@ -98,8 +107,12 @@ typedef void * PROrderedLock;
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
#define PR_CREATE_ORDERED_LOCK(order,name)\
PR_CreateOrderedLock((order),(name))
#else
#define PR_CREATE_ORDERED_LOCK(order) PR_NewLock()
#endif
NSPR_API(PROrderedLock *)
PR_CreateOrderedLock(
@ -122,7 +135,11 @@ NSPR_API(PROrderedLock *)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
#define PR_DESTROY_ORDERED_LOCK(lock) PR_DestroyOrderedLock((lock))
#else
#define PR_DESTROY_ORDERED_LOCK(lock) PR_DestroyLock((lock))
#endif
NSPR_API(void)
PR_DestroyOrderedLock(
@ -146,7 +163,11 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
#define PR_LOCK_ORDERED_LOCK(lock) PR_LockOrderedLock((lock))
#else
#define PR_LOCK_ORDERED_LOCK(lock) PR_Lock((lock))
#endif
NSPR_API(void)
PR_LockOrderedLock(
@ -170,43 +191,17 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)
#define PR_UNLOCK_ORDERED_LOCK(lock) PR_UnlockOrderedLock((lock))
#else
#define PR_UNLOCK_ORDERED_LOCK(lock) PR_Unlock((lock))
#endif
NSPR_API(PRStatus)
PR_UnlockOrderedLock(
PROrderedLock *lock
);
#else /* !(defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)) */
/*
** Map PROrderedLock and methods onto PRLock when ordered locking
** is not compiled in.
**
*/
#include <prlock.h>
typedef PRLock PROrderedLock;
#define PR_CREATE_ORDERED_LOCK(order) PR_NewLock()
#define PR_DESTROY_ORDERED_LOCK(lock) PR_DestroyLock((lock))
#define PR_LOCK_ORDERED_LOCK(lock) PR_Lock((lock))
#define PR_UNLOCK_ORDERED_LOCK(lock) PR_Unlock((lock))
#endif /* !(defined(DEBUG) || defined(FORCE_NSPR_ORDERED_LOCKS)) */
PR_END_EXTERN_C
#endif /* prolock_h___ */

Просмотреть файл

@ -103,7 +103,6 @@ PR_BEGIN_EXTERN_C
*/
typedef void * PRTraceHandle;
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
/*
** PRTraceEntry -- A trace entry in the in-memory trace buffer
** looks like this.
@ -153,8 +152,12 @@ typedef enum PRTraceOption
** to value. e.g. PR_INIT_TRACE_HANDLE( myHandle, NULL );
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_INIT_TRACE_HANDLE(handle,value)\
(handle) = (PRCounterHandle)(value)
#else
#define PR_INIT_TRACE_HANDLE(handle,value)
#endif
/* -----------------------------------------------------------------------
@ -192,8 +195,12 @@ typedef enum PRTraceOption
#define PRTRACE_NAME_MAX 31
#define PRTRACE_DESC_MAX 255
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_CREATE_TRACE(handle,qName,rName,description)\
(handle) = PR_CreateTrace((qName),(rName),(description))
#else
#define PR_CREATE_TRACE(handle,qName,rName,description)
#endif
NSPR_API(PRTraceHandle)
PR_CreateTrace(
@ -222,8 +229,12 @@ NSPR_API(PRTraceHandle)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_DESTROY_TRACE(handle)\
PR_DestroyTrace((handle))
#else
#define PR_DESTROY_TRACE(handle)
#endif
NSPR_API(void)
PR_DestroyTrace(
@ -259,8 +270,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_TRACE(handle,ud0,ud1,ud2,ud3,ud4,ud5,ud6,ud7)\
PR_Trace((handle),(ud0),(ud1),(ud2),(ud3),(ud4),(ud5),(ud6),(ud7))
#else
#define PR_TRACE(handle,ud0,ud1,ud2,ud3,ud4,ud5,ud6,ud7)
#endif
NSPR_API(void)
PR_Trace(
@ -342,8 +357,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_SET_TRACE_OPTION(command,value)\
PR_SetTraceOption((command),(value))
#else
#define PR_SET_TRACE_OPTION(command,value)
#endif
NSPR_API(void)
PR_SetTraceOption(
@ -376,8 +395,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_GET_TRACE_OPTION(command,value)\
PR_GetTraceOption((command),(value))
#else
#define PR_GET_TRACE_OPTION(command,value)
#endif
NSPR_API(void)
PR_GetTraceOption(
@ -408,8 +431,12 @@ NSPR_API(void)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_GET_TRACE_HANDLE_FROM_NAME(handle,qName,rName)\
(handle) = PR_GetTraceHandleFromName((qName),(rName))
#else
#define PR_GET_TRACE_HANDLE_FROM_NAME(handle,qName,rName)
#endif
NSPR_API(PRTraceHandle)
PR_GetTraceHandleFromName(
@ -436,8 +463,12 @@ NSPR_API(PRTraceHandle)
** RESTRICTIONS:
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_GET_TRACE_NAME_FROM_HANDLE(handle,qName,rName,description)\
PR_GetTraceNameFromHandle((handle),(qName),(rName),(description))
#else
#define PR_GET_TRACE_NAME_FROM_HANDLE(handle,qName,rName,description)
#endif
NSPR_API(void)
PR_GetTraceNameFromHandle(
@ -474,8 +505,12 @@ NSPR_API(void)
** See: PR_SetTraceOption( PRLockTraceHandles ).
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_FIND_NEXT_TRACE_QNAME(next,handle)\
(next) = PR_FindNextTraceQname((handle))
#else
#define PR_FIND_NEXT_TRACE_QNAME(next,handle)
#endif
NSPR_API(PRTraceHandle)
PR_FindNextTraceQname(
@ -512,8 +547,12 @@ NSPR_API(PRTraceHandle)
** PR_SetTraceOption( PRLockTraceHandles ).
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_FIND_NEXT_TRACE_RNAME(next,rhandle,qhandle)\
(next) = PR_FindNextTraceRname((rhandle),(qhandle))
#else
#define PR_FIND_NEXT_TRACE_RNAME(next,rhandle,qhandle)
#endif
NSPR_API(PRTraceHandle)
PR_FindNextTraceRname(
@ -564,8 +603,12 @@ NSPR_API(PRTraceHandle)
** On error, PR_RecordTraceEntries() may return prematurely.
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_RECORD_TRACE_ENTRIES()\
PR_RecordTraceEntries()
#else
#define PR_RECORD_TRACE_ENTRIES()
#endif
NSPR_API(void)
PR_RecordTraceEntries(
@ -612,9 +655,12 @@ NSPR_API(void)
** application may be realized. ... YMMV.
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#define PR_GET_TRACE_ENTRIES(buffer,count,found)\
PR_GetTraceEntries((buffer),(count),(found))
#else
#define PR_GET_TRACE_ENTRIES(buffer,count,found)
#endif
NSPR_API(PRIntn)
PR_GetTraceEntries(
@ -623,28 +669,6 @@ NSPR_API(PRIntn)
PRInt32 *found /* number you got */
);
#else /* !(defined (DEBUG) || defined (FORCE_NSPR_TRACE)) */
/*
** Define the Trace Facility macros as No-Ops for when the trace
** facility is to be compiled-out of the application.
**
*/
#define PR_DEFINE_TRACE(name) PRTraceHandle name
#define PR_INIT_TRACE_HANDLE(handle,value)
#define PR_CREATE_TRACE(handle,qName,rName,description)
#define PR_DESTROY_TRACE(handle)
#define PR_TRACE(handle,ud0,ud1,ud2,ud3,ud4,ud5,ud6,ud7)
#define PR_SET_TRACE_OPTION(command,value)
#define PR_GET_TRACE_OPTION(command,value)
#define PR_GET_TRACE_HANDLE_FROM_NAME(handle,qName,rName)
#define PR_GET_TRACE_NAME_FROM_HANDLE(handle,qName,rName,description)
#define PR_FIND_NEXT_TRACE_QNAME(next,handle)
#define PR_FIND_NEXT_TRACE_RNAME(next,rhandle,qhandle)
#define PR_GET_TRACE_ENTRIES(buffer,count,found)
#define PR_RECORD_TRACE_ENTRIES()
#endif /* !(defined (DEBUG) || defined (FORCE_NSPR_TRACE)) */
PR_END_EXTERN_C
#endif /* prtrace_h___ */

Просмотреть файл

@ -68,7 +68,6 @@
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#include "prcountr.h"
#include "prclist.h"
#include "prlock.h"
@ -502,14 +501,3 @@ PR_IMPLEMENT(PRCounterHandle)
return((PRCounterHandle)rnp);
} /* end PR_FindNextCounterRname() */
#else /* !(defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)) */
/*
** NSPR Counters are not defined in this case
**
**
*/
/* Some compilers don't like an empty compilation unit. */
static int dummy = 0;
#endif /* defined(DEBUG) || defined(FORCE_NSPR_COUNTERS) */

Просмотреть файл

@ -38,7 +38,6 @@
** Implement the API defined in prolock.h
**
*/
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
#include "prolock.h"
#include "prlog.h"
#include "prerror.h"
@ -96,13 +95,3 @@ PR_IMPLEMENT(PRStatus)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
} /* end PR_UnlockOrderedLock() */
#else /* ! defined(FORCE_NSPR_ORDERED_LOCK) */
/*
** NSPR Ordered Lock is not defined when !DEBUG and !FORCE_NSPR_ORDERED_LOCK
**
*/
/* Some compilers don't like an empty compilation unit. */
static int dummy = 0;
#endif /* defined(FORCE_NSPR_ORDERED_LOCK */

Просмотреть файл

@ -41,7 +41,6 @@
**
*/
#if defined (DEBUG) || defined (FORCE_NSPR_TRACE)
#include <string.h>
#include "prtrace.h"
#include "prclist.h"
@ -917,14 +916,4 @@ PR_IMPLEMENT(PRIntn)
return rc;
} /* end PR_GetTraceEntries() */
#else /* !defined(FORCE_NSPR_TRACE) */
/*
** The trace facility is not defined when !DEBUG and !FORCE_NSPR_TRACE
**
*/
/* Some compilers don't like an empty compilation unit. */
static int dummy = 0;
#endif /* defined(FORCE_NSPR_TRACE) */
/* end prtrace.c */