Bug 158704: PT_FPrintStats also needs to be exported (for the test programs NSPRPUB_RELEASE_4_1_BRANCH NSPRPUB_RELEASE_4_1_3_RTM NSPRPUB_RELEASE_4_1_3_SunRC010903 NSPR_4_1_3_RTM SUN_COMPONENT_PACK_V_1_1
authorwtc%netscape.com
Wed, 08 Jan 2003 03:25:54 +0000
branchNSPRPUB_RELEASE_4_1_BRANCH
changeset 2638 422655479e0e589cc26a74ed329aaf7fd4d95fae
parent 2637 8b1f6a4d1355d235056d9112920b4241fe288fc6
child 2680 c2512213e9fec727ea7324478b27f2cbb7ba30b0
push idunknown
push userunknown
push dateunknown
bugs158704
Bug 158704: PT_FPrintStats also needs to be exported (for the test programs only). Define it as a no-op in optimized builds or classic NSPR. Deleted PT_GetStats, which is not useful. Modified files: primpl.h, nspr.def, prio.c, ptio.c Tag: NSPRPUB_RELEASE_4_1_BRANCH
pr/include/private/primpl.h
pr/src/io/prio.c
pr/src/nspr.def
pr/src/pthreads/ptio.c
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -211,32 +211,23 @@ typedef struct PTDebug
 {
     PRTime timeStarted;
     PRUintn locks_created, locks_destroyed;
     PRUintn locks_acquired, locks_released;
     PRUintn cvars_created, cvars_destroyed;
     PRUintn cvars_notified, delayed_cv_deletes;
 } PTDebug;
 
-NSPR_API(void) PT_GetStats(PTDebug* here);
-NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);
-
-#else
+#endif /* defined(DEBUG) */
 
-typedef PRUintn PTDebug;
-#define PT_GetStats(_p)
-#define PT_FPrintStats(_fd, _msg)
-
-#endif /* defined(DEBUG) */
+NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);
 
 #else /* defined(_PR_PTHREADS) */
 
-typedef PRUintn PTDebug;
-#define PT_GetStats(_p)
-#define PT_FPrintStats(_fd, _msg)
+NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);
 
 /*
 ** This section is contains those parts needed to implement NSPR on
 ** platforms in general. One would assume that the pthreads implementation
 ** included lots of the same types, at least conceptually.
 */
 
 /*
--- a/pr/src/io/prio.c
+++ b/pr/src/io/prio.c
@@ -162,8 +162,17 @@ PR_IMPLEMENT(PRStatus) PR_SetFDInheritab
 #else
 #ifdef XP_MAC
 #pragma unused (fd, inheritable)
 #endif
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
     return PR_FAILURE;
 #endif
 }
+
+/*
+** This function only has a useful implementation in the debug build of
+** the pthreads version.
+*/
+PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
+{
+    /* do nothing */
+}  /* PT_FPrintStats */
--- a/pr/src/nspr.def
+++ b/pr/src/nspr.def
@@ -366,16 +366,17 @@ NSPR_4.0 {
 		PRP_TryLock;
 		libVersionPoint;
 	local: *;
 };
 
 NSPRprivate {
 	global:
 		GetExecutionEnvironment;
+		PT_FPrintStats;
 		SetExecutionEnvironment;
 	local: *;
 };
 
 NSPR_4.1 {
 	global:
 		PR_ConnectContinue;
 		PR_CreateIOLayer;
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -338,25 +338,23 @@ struct pt_Continuation
     PRIntn syserrno;                        /* in case it failed, why (errno) */
     pr_ContuationStatus status;             /* the status of the operation */
 };
 
 #if defined(DEBUG)
 
 PTDebug pt_debug;  /* this is shared between several modules */
 
-PR_IMPLEMENT(void) PT_GetStats(PTDebug* here) { *here = pt_debug; }
-
 PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
 {
     PTDebug stats;
     char buffer[100];
     PRExplodedTime tod;
     PRInt64 elapsed, aMil;
-    PT_GetStats(&stats);  /* a copy */
+    stats = pt_debug;  /* a copy */
     PR_ExplodeTime(stats.timeStarted, PR_LocalTimeParameters, &tod);
     (void)PR_FormatTime(buffer, sizeof(buffer), "%T", &tod);
 
     LL_SUB(elapsed, PR_Now(), stats.timeStarted);
     LL_I2L(aMil, 1000000);
     LL_DIV(elapsed, elapsed, aMil);
     
     if (NULL != msg) PR_fprintf(debug_out, "%s", msg);
@@ -371,16 +369,23 @@ PR_IMPLEMENT(void) PT_FPrintStats(PRFile
     PR_fprintf(
         debug_out, "\tcvars [created: %u, destroyed: %u]\n",
         stats.cvars_created, stats.cvars_destroyed);
     PR_fprintf(
         debug_out, "\tcvars [notified: %u, delayed_delete: %u]\n",
         stats.cvars_notified, stats.delayed_cv_deletes);
 }  /* PT_FPrintStats */
 
+#else
+
+PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
+{
+    /* do nothing */
+}  /* PT_FPrintStats */
+
 #endif  /* DEBUG */
 
 #if defined(_PR_POLL_WITH_SELECT)
 /*
  * OSF1 and HPUX report the POLLHUP event for a socket when the
  * shutdown(SHUT_WR) operation is called for the remote end, even though
  * the socket is still writeable. Use select(), instead of poll(), to
  * workaround this problem.