diff options
Diffstat (limited to 'pr/src/misc')
-rw-r--r-- | pr/src/misc/pralarm.c | 4 | ||||
-rw-r--r-- | pr/src/misc/pratom.c | 6 | ||||
-rw-r--r-- | pr/src/misc/praton.c | 8 | ||||
-rw-r--r-- | pr/src/misc/prcountr.c | 148 | ||||
-rw-r--r-- | pr/src/misc/prdtoa.c | 4 | ||||
-rw-r--r-- | pr/src/misc/prerrortable.c | 6 | ||||
-rw-r--r-- | pr/src/misc/prinit.c | 20 | ||||
-rw-r--r-- | pr/src/misc/prnetdb.c | 46 | ||||
-rw-r--r-- | pr/src/misc/prolock.c | 26 | ||||
-rw-r--r-- | pr/src/misc/prrng.c | 12 | ||||
-rw-r--r-- | pr/src/misc/prsystem.c | 10 | ||||
-rw-r--r-- | pr/src/misc/prthinfo.c | 4 | ||||
-rw-r--r-- | pr/src/misc/prtime.c | 126 | ||||
-rw-r--r-- | pr/src/misc/prtpool.c | 18 | ||||
-rw-r--r-- | pr/src/misc/prtrace.c | 118 |
15 files changed, 278 insertions, 278 deletions
diff --git a/pr/src/misc/pralarm.c b/pr/src/misc/pralarm.c index 8f642bb1..907277ef 100644 --- a/pr/src/misc/pralarm.c +++ b/pr/src/misc/pralarm.c @@ -50,9 +50,9 @@ static PRAlarmID *pr_getNextAlarm(PRAlarm *alarm, PRAlarmID *id) PRIntervalTime now = PR_IntervalNow(); if (!PR_CLIST_IS_EMPTY(&alarm->timers)) - { + { if (id != NULL) /* have to put this id back in */ - { + { PRIntervalTime idDelta = now - id->nextNotify; timer = alarm->timers.next; do diff --git a/pr/src/misc/pratom.c b/pr/src/misc/pratom.c index 65e6f3cd..7662ef36 100644 --- a/pr/src/misc/pratom.c +++ b/pr/src/misc/pratom.c @@ -88,7 +88,7 @@ int index; if (num_atomic_locks > MAX_ATOMIC_LOCKS) num_atomic_locks = MAX_ATOMIC_LOCKS; - else if (num_atomic_locks < 1) + else if (num_atomic_locks < 1) num_atomic_locks = 1; else { num_atomic_locks = PR_FloorLog2(num_atomic_locks); @@ -101,7 +101,7 @@ int index; if (pthread_mutex_init(&atomic_locks[index], NULL)) { PR_DELETE(atomic_locks); atomic_locks = NULL; - break; + break; } } } @@ -328,7 +328,7 @@ PRStack *stack; #endif /* !_PR_HAVE_ATOMIC_CAS */ stack->prstk_head.prstk_elem_next = NULL; - + return stack; } diff --git a/pr/src/misc/praton.c b/pr/src/misc/praton.c index 80c0628c..c9668700 100644 --- a/pr/src/misc/praton.c +++ b/pr/src/misc/praton.c @@ -10,7 +10,7 @@ /* * Copyright (c) 1983, 1990, 1993 * The Regents of the University of California. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -22,7 +22,7 @@ * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -38,14 +38,14 @@ /* * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT diff --git a/pr/src/misc/prcountr.c b/pr/src/misc/prcountr.c index 0f126ad0..edd57122 100644 --- a/pr/src/misc/prcountr.c +++ b/pr/src/misc/prcountr.c @@ -10,16 +10,16 @@ ** ** Design Notes: ** -** The Counter Facility (CF) has a single anchor: qNameList. +** The Counter Facility (CF) has a single anchor: qNameList. ** The anchor is a PRCList. qNameList is a list of links in QName ** structures. From qNameList any QName structure and its -** associated RName structure can be located. -** +** associated RName structure can be located. +** ** For each QName, a list of RName structures is anchored at ** rnLink in the QName structure. -** +** ** The counter itself is embedded in the RName structure. -** +** ** For manipulating the counter database, single lock is used to ** protect the entire list: counterLock. ** @@ -29,7 +29,7 @@ ** "overloaded" for traversing the QName structures; only the ** function PR_FindNextQnameHandle() uses this overloading. ** -** +** ** ToDo (lth): decide on how to lock or atomically update ** individual counters. Candidates are: the global lock; a lock ** per RName structure; Atomic operations (Note that there are @@ -64,9 +64,9 @@ typedef struct RName PRCList link; QName *qName; PRLock *lock; - volatile PRUint32 counter; - char name[PRCOUNTER_NAME_MAX+1]; - char desc[PRCOUNTER_DESC_MAX+1]; + volatile PRUint32 counter; + char name[PRCOUNTER_NAME_MAX+1]; + char desc[PRCOUNTER_DESC_MAX+1]; } RName; @@ -87,7 +87,7 @@ static void _PR_CounterInitialize( void ) ** This function should be called only once */ PR_ASSERT( counterLock == NULL ); - + counterLock = PR_NewLock(); PR_INIT_CLIST( &qNameList ); lm = PR_NewLogModule("counters"); @@ -111,12 +111,12 @@ static void _PR_CounterInitialize( void ) ** Unlock ** */ -PR_IMPLEMENT(PRCounterHandle) - PR_CreateCounter( - const char *qName, - const char *rName, - const char *description -) +PR_IMPLEMENT(PRCounterHandle) + PR_CreateCounter( + const char *qName, + const char *rName, + const char *description +) { QName *qnp; RName *rnp; @@ -157,10 +157,10 @@ PR_IMPLEMENT(PRCounterHandle) { qnp = PR_NEWZAP( QName ); PR_ASSERT( qnp != NULL ); - PR_INIT_CLIST( &qnp->link ); - PR_INIT_CLIST( &qnp->rNameList ); + PR_INIT_CLIST( &qnp->link ); + PR_INIT_CLIST( &qnp->rNameList ); strcpy( qnp->name, qName ); - PR_APPEND_LINK( &qnp->link, &qNameList ); + PR_APPEND_LINK( &qnp->link, &qNameList ); } /* Do we already have a matching RName? */ @@ -189,7 +189,7 @@ PR_IMPLEMENT(PRCounterHandle) PR_ASSERT(0); } - PR_APPEND_LINK( &rnp->link, &qnp->rNameList ); /* add RName to QName's rnList */ + PR_APPEND_LINK( &rnp->link, &qnp->rNameList ); /* add RName to QName's rnList */ rnp->qName = qnp; /* point the RName to the QName */ /* Unlock the Facility */ @@ -199,20 +199,20 @@ PR_IMPLEMENT(PRCounterHandle) return((PRCounterHandle)rnp); } /* end PR_CreateCounter() */ - + /* ** */ -PR_IMPLEMENT(void) - PR_DestroyCounter( - PRCounterHandle handle +PR_IMPLEMENT(void) + PR_DestroyCounter( + PRCounterHandle handle ) { RName *rnp = (RName *)handle; QName *qnp = rnp->qName; - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting: QName: %s, RName: %s", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting: QName: %s, RName: %s", qnp->name, rnp->name)); /* Lock the Facility */ @@ -222,7 +222,7 @@ PR_IMPLEMENT(void) ** Remove RName from the list of RNames in QName ** and free RName */ - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting RName: %s, %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting RName: %s, %p", rnp->name, rnp)); PR_REMOVE_LINK( &rnp->link ); PR_Free( rnp->lock ); @@ -234,11 +234,11 @@ PR_IMPLEMENT(void) */ if ( PR_CLIST_IS_EMPTY( &qnp->rNameList ) ) { - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting unused QName: %s, %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Deleting unused QName: %s, %p", qnp->name, qnp)); PR_REMOVE_LINK( &qnp->link ); PR_DELETE( qnp ); - } + } /* Unlock the Facility */ PR_Unlock( counterLock ); @@ -248,10 +248,10 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(PRCounterHandle) - PR_GetCounterHandleFromName( - const char *qName, - const char *rName +PR_IMPLEMENT(PRCounterHandle) + PR_GetCounterHandleFromName( + const char *qName, + const char *rName ) { const char *qn, *rn, *desc; @@ -287,12 +287,12 @@ foundIt: /* ** */ -PR_IMPLEMENT(void) - PR_GetCounterNameFromHandle( - PRCounterHandle handle, - const char **qName, - const char **rName, - const char **description +PR_IMPLEMENT(void) + PR_GetCounterNameFromHandle( + PRCounterHandle handle, + const char **qName, + const char **rName, + const char **description ) { RName *rnp = (RName *)handle; @@ -303,7 +303,7 @@ PR_IMPLEMENT(void) *description = rnp->desc; PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: GetConterNameFromHandle: " - "QNp: %p, RNp: %p,\n\tQName: %s, RName: %s, Desc: %s", + "QNp: %p, RNp: %p,\n\tQName: %s, RName: %s, Desc: %s", qnp, rnp, qnp->name, rnp->name, rnp->desc )); return; @@ -313,8 +313,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_IncrementCounter( +PR_IMPLEMENT(void) + PR_IncrementCounter( PRCounterHandle handle ) { @@ -322,7 +322,7 @@ PR_IMPLEMENT(void) ((RName *)handle)->counter++; PR_Unlock(((RName *)handle)->lock); - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Increment: %p, %ld", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Increment: %p, %ld", handle, ((RName *)handle)->counter )); return; @@ -333,8 +333,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_DecrementCounter( +PR_IMPLEMENT(void) + PR_DecrementCounter( PRCounterHandle handle ) { @@ -342,7 +342,7 @@ PR_IMPLEMENT(void) ((RName *)handle)->counter--; PR_Unlock(((RName *)handle)->lock); - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Decrement: %p, %ld", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: Decrement: %p, %ld", handle, ((RName *)handle)->counter )); return; @@ -352,17 +352,17 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_AddToCounter( - PRCounterHandle handle, - PRUint32 value +PR_IMPLEMENT(void) + PR_AddToCounter( + PRCounterHandle handle, + PRUint32 value ) { PR_Lock(((RName *)handle)->lock); ((RName *)handle)->counter += value; PR_Unlock(((RName *)handle)->lock); - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: AddToCounter: %p, %ld", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: AddToCounter: %p, %ld", handle, ((RName *)handle)->counter )); return; @@ -372,17 +372,17 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_SubtractFromCounter( - PRCounterHandle handle, - PRUint32 value +PR_IMPLEMENT(void) + PR_SubtractFromCounter( + PRCounterHandle handle, + PRUint32 value ) { PR_Lock(((RName *)handle)->lock); ((RName *)handle)->counter -= value; PR_Unlock(((RName *)handle)->lock); - - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: SubtractFromCounter: %p, %ld", + + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: SubtractFromCounter: %p, %ld", handle, ((RName *)handle)->counter )); return; @@ -391,12 +391,12 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(PRUint32) - PR_GetCounter( - PRCounterHandle handle +PR_IMPLEMENT(PRUint32) + PR_GetCounter( + PRCounterHandle handle ) { - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: GetCounter: %p, %ld", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: GetCounter: %p, %ld", handle, ((RName *)handle)->counter )); return(((RName *)handle)->counter); @@ -405,15 +405,15 @@ PR_IMPLEMENT(PRUint32) /* ** */ -PR_IMPLEMENT(void) - PR_SetCounter( - PRCounterHandle handle, - PRUint32 value +PR_IMPLEMENT(void) + PR_SetCounter( + PRCounterHandle handle, + PRUint32 value ) { ((RName *)handle)->counter = value; - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: SetCounter: %p, %ld", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: SetCounter: %p, %ld", handle, ((RName *)handle)->counter )); return; @@ -422,8 +422,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(PRCounterHandle) - PR_FindNextCounterQname( +PR_IMPLEMENT(PRCounterHandle) + PR_FindNextCounterQname( PRCounterHandle handle ) { @@ -435,10 +435,10 @@ PR_IMPLEMENT(PRCounterHandle) qnp = (QName *)PR_LIST_HEAD( &qNameList ); else if ( PR_NEXT_LINK( &qnp->link ) == &qNameList ) qnp = NULL; - else + else qnp = (QName *)PR_NEXT_LINK( &qnp->link ); - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextQname: Handle: %p, Returns: %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextQname: Handle: %p, Returns: %p", handle, qnp )); return((PRCounterHandle)qnp); @@ -448,10 +448,10 @@ PR_IMPLEMENT(PRCounterHandle) /* ** */ -PR_IMPLEMENT(PRCounterHandle) - PR_FindNextCounterRname( - PRCounterHandle rhandle, - PRCounterHandle qhandle +PR_IMPLEMENT(PRCounterHandle) + PR_FindNextCounterRname( + PRCounterHandle rhandle, + PRCounterHandle qhandle ) { RName *rnp = (RName *)rhandle; @@ -467,7 +467,7 @@ PR_IMPLEMENT(PRCounterHandle) else rnp = (RName *)PR_NEXT_LINK( &rnp->link ); - PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextRname: Rhandle: %p, QHandle: %p, Returns: %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextRname: Rhandle: %p, QHandle: %p, Returns: %p", rhandle, qhandle, rnp )); return((PRCounterHandle)rnp); diff --git a/pr/src/misc/prdtoa.c b/pr/src/misc/prdtoa.c index 22769261..c3423286 100644 --- a/pr/src/misc/prdtoa.c +++ b/pr/src/misc/prdtoa.c @@ -3424,7 +3424,7 @@ PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn ndigits, rv = PR_SUCCESS; } freedtoa(result); - return rv; + return rv; } /* @@ -3432,7 +3432,7 @@ PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn ndigits, ** prcsn - number of digits of precision to generate floating ** point value. ** This should be reparameterized so that you can send in a -** prcn for the positive and negative ranges. For now, +** prcn for the positive and negative ranges. For now, ** conform to the ECMA JavaScript spec which says numbers ** less than 1e-6 are in scientific notation. ** Also, the ECMA spec says that there should always be a diff --git a/pr/src/misc/prerrortable.c b/pr/src/misc/prerrortable.c index 285fde97..7ce11d81 100644 --- a/pr/src/misc/prerrortable.c +++ b/pr/src/misc/prerrortable.c @@ -107,7 +107,7 @@ PR_ErrorToString(PRErrorCode code, PRLanguageCode language) callback_private, et->table_private); if (msg) return msg; } - + return(et->table->msgs[code - et->table->base].en_text); } } @@ -183,7 +183,7 @@ PR_ErrorInstallTable(const struct PRErrorTable *table) PR_IMPLEMENT(void) PR_ErrorInstallCallback(const char * const * languages, - PRErrorCallbackLookupFn *lookup, + PRErrorCallbackLookupFn *lookup, PRErrorCallbackNewTableFn *newtable, struct PRErrorCallbackPrivate *cb_private) { @@ -191,7 +191,7 @@ PR_ErrorInstallCallback(const char * const * languages, assert(strcmp(languages[0], "i-default") == 0); assert(strcmp(languages[1], "en") == 0); - + callback_languages = languages; callback_lookup = lookup; callback_newtable = newtable; diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c index 89cf3277..61cb63bd 100644 --- a/pr/src/misc/prinit.c +++ b/pr/src/misc/prinit.c @@ -161,8 +161,8 @@ static void _PR_InitStuff(void) _pr_gc_lm = PR_NewLogModule("gc"); _pr_shm_lm = PR_NewLogModule("shm"); _pr_shma_lm = PR_NewLogModule("shma"); - - /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */ + + /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */ _PR_MD_EARLY_INIT(); _PR_InitLocks(); @@ -178,13 +178,13 @@ static void _PR_InitStuff(void) PR_ASSERT(NULL != _pr_sleeplock); _PR_InitThreads(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - + #ifdef WIN16 { PRInt32 top; /* artificial top of stack, win16 */ _pr_top_of_task_stack = (char *) ⊤ } -#endif +#endif #ifndef _PR_GLOBAL_THREADS_ONLY _PR_InitCPUs(); @@ -281,7 +281,7 @@ PR_IMPLEMENT(PRIntn) PR_Initialize( * * _PR_CleanupBeforeExit -- * - * Perform the cleanup work before exiting the process. + * Perform the cleanup work before exiting the process. * We first do the cleanup generic to all platforms. Then * we call _PR_MD_CLEANUP_BEFORE_EXIT(), where platform-dependent * cleanup is done. This function is used by PR_Cleanup(). @@ -296,7 +296,7 @@ PR_IMPLEMENT(PRIntn) PR_Initialize( static void _PR_CleanupBeforeExit(void) { -/* +/* Do not make any calls here other than to destroy resources. For example, do not make any calls that eventually may end up in PR_Lock. Because the thread is destroyed, can not access current thread any more. @@ -329,7 +329,7 @@ thread is destroyed, can not access current thread any more. * Then it performs cleanup in preparation for exiting the process. * PR_Cleanup() does not exit the primordial thread (which would * in turn exit the process). - * + * * PR_Cleanup() only responds when it is called by the primordial * thread. Calls by any other thread are silently ignored. * @@ -428,11 +428,11 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() /* *------------------------------------------------------------------------ * PR_ProcessExit -- - * + * * Cause an immediate, nongraceful, forced termination of the process. * It takes a PRIntn argument, which is the exit status code of the * process. - * + * * See also: PR_Cleanup() * *------------------------------------------------------------------------ @@ -609,7 +609,7 @@ PR_ProcessAttrSetInheritableFD( nwritten = PR_snprintf(cur, freeSize, ":%s:%d:0x%" PR_PRIxOSFD, name, (PRIntn)fd->methods->file_type, fd->secret->md.osfd); } - attr->fdInheritBufferUsed += nwritten; + attr->fdInheritBufferUsed += nwritten; return PR_SUCCESS; } diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index 76a1f1e3..923e75f9 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -97,7 +97,7 @@ extern PRBool _pr_ipv6_is_present(void); ((a)->pr_s6_addr32[1] == 0) && \ ((a)->pr_s6_addr32[2] == 0) && \ ((a)->pr_s6_addr32[3] == 0)) - + #define _PR_IN6_IS_ADDR_LOOPBACK(a) \ (((a)->pr_s6_addr32[0] == 0) && \ ((a)->pr_s6_addr32[1] == 0) && \ @@ -106,7 +106,7 @@ extern PRBool _pr_ipv6_is_present(void); ((a)->pr_s6_addr[13] == 0) && \ ((a)->pr_s6_addr[14] == 0) && \ ((a)->pr_s6_addr[15] == 0x1U)) - + const PRIPv6Addr _pr_in6addr_any = {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -263,13 +263,13 @@ _pr_QueryNetIfs(void) struct sockaddr_in *sin = (struct sockaddr_in *) sa; if (sin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { _pr_have_inet_if = PR_TRUE; - } + } } else if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; if (!IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && !IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { _pr_have_inet6_if = PR_TRUE; - } + } } #ifdef _PR_HAVE_SOCKADDR_LEN @@ -352,15 +352,15 @@ _pr_QueryNetIfs(void) struct sockaddr_in *sin = (struct sockaddr_in *) sa; if (sin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { _pr_have_inet_if = 1; - } + } } else if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; if (!IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && !IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { _pr_have_inet6_if = 1; - } + } } - } + } freeifaddrs(ifp); } @@ -604,7 +604,7 @@ static PRStatus CopyProtoent( * ################################################################# * NOTE: tmphe, tmpbuf, bufsize, h, and h_err are local variables * or arguments of PR_GetHostByName, PR_GetIPNodeByName, and - * PR_GetHostByAddr. DO NOT CHANGE THE NAMES OF THESE LOCAL + * PR_GetHostByAddr. DO NOT CHANGE THE NAMES OF THESE LOCAL * VARIABLES OR ARGUMENTS. * ################################################################# */ @@ -665,7 +665,7 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByName( LOCK_DNS(); h = GETHOSTBYNAME(name); - + if (NULL == h) { PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_GETHOST_ERRNO()); @@ -703,7 +703,7 @@ static void * _pr_freehostent_fp; PRStatus _pr_find_getipnodebyname(void) { - PRLibrary *lib; + PRLibrary *lib; PRStatus rv; #define GETIPNODEBYNAME "getipnodebyname" #define GETIPNODEBYADDR "getipnodebyaddr" @@ -740,7 +740,7 @@ static PRStatus AppendV4AddrsToHostent( PRIntn na, na_old; char **ap; char **new_addr_list; - + /* Count the addresses, then grow storage for the pointers */ for (na_old = 0, ap = to->h_addr_list; *ap != 0; na_old++, ap++) {;} /* nothing to execute */ @@ -851,7 +851,7 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName( #ifdef _PR_INET6_PROBE if (_pr_ipv6_is_present()) #endif - h = GETHOSTBYNAME2(name, AF_INET6); + h = GETHOSTBYNAME2(name, AF_INET6); } if ((NULL == h) && (flags & PR_AI_V4MAPPED) && ((flags & PR_AI_ADDRCONFIG) == 0 || _pr_have_inet_if)) @@ -890,7 +890,7 @@ PR_IMPLEMENT(PRStatus) PR_GetIPNodeByName( LOCK_DNS(); h = GETHOSTBYNAME(name); #endif /* _PR_INET6 */ - + if (NULL == h) { #if defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME) @@ -1565,7 +1565,7 @@ static int StringToV6Addr(const char *string, PRIPv6Addr *addr) } addr->pr_s6_addr16[section++] = htons((unsigned short)val); } - + if (*s == '.') { /* Have a trailing v4 format address */ if (section > 6) return 0; /* not enough room */ @@ -1611,13 +1611,13 @@ static int StringToV6Addr(const char *string, PRIPv6Addr *addr) addr->pr_s6_addr[2 * section + 1] = val; section++; } - + if (double_colon != -1) { /* Stretch the double colon */ int tosection; int ncopy = section - double_colon; for (tosection = 7; ncopy--; tosection--) { - addr->pr_s6_addr16[tosection] = + addr->pr_s6_addr16[tosection] = addr->pr_s6_addr16[double_colon + ncopy]; } while (tosection >= double_colon) { @@ -1734,7 +1734,7 @@ static const char *V6AddrToString( } STUFF('\0'); return bufcopy; -#undef STUFF +#undef STUFF } #endif /* !_PR_HAVE_INET_NTOP */ @@ -1814,7 +1814,7 @@ typedef struct addrinfo PRADDRINFO; typedef struct addrinfo PRADDRINFO; -/* getaddrinfo/freeaddrinfo/getnameinfo prototypes */ +/* getaddrinfo/freeaddrinfo/getnameinfo prototypes */ #if defined(WIN32) #define FUNC_MODIFIER __stdcall #else @@ -1911,7 +1911,7 @@ _pr_find_getaddrinfo(void) #if !defined(_PR_HAVE_GETADDRINFO) || defined(_PR_INET6_PROBE) /* * If getaddrinfo does not exist, then we will fall back on - * PR_GetHostByName, which requires that we allocate a buffer for the + * PR_GetHostByName, which requires that we allocate a buffer for the * PRHostEnt data structure and its members. */ typedef struct PRAddrInfoFB { @@ -1979,11 +1979,11 @@ PR_IMPLEMENT(PRAddrInfo *) PR_GetAddrInfoByName(const char *hostname, if (!(flags & PR_AI_NOCANONNAME)) hints.ai_flags |= AI_CANONNAME; #ifdef AI_ADDRCONFIG - /* + /* * Propagate AI_ADDRCONFIG to the GETADDRINFO call if PR_AI_ADDRCONFIG * is set. - * - * Need a workaround for loopback host addresses: + * + * Need a workaround for loopback host addresses: * The problem is that in glibc and Windows, AI_ADDRCONFIG applies the * existence of an outgoing network interface to IP addresses of the * loopback interface, due to a strict interpretation of the @@ -2104,7 +2104,7 @@ PR_IMPLEMENT(const char *) PR_GetCanonNameFromAddrInfo(const PRAddrInfo *ai) if (!_pr_ipv6_is_present()) { const PRAddrInfoFB *fb = (const PRAddrInfoFB *) ai; return fb->has_cname ? fb->hostent.h_name : NULL; - } + } #endif return ((const PRADDRINFO *) ai)->ai_canonname; #else diff --git a/pr/src/misc/prolock.c b/pr/src/misc/prolock.c index 38b77878..a8115460 100644 --- a/pr/src/misc/prolock.c +++ b/pr/src/misc/prolock.c @@ -5,16 +5,16 @@ /* ** prolock.c -- NSPR Ordered Lock -** +** ** Implement the API defined in prolock.h -** +** */ #include "prolock.h" #include "prlog.h" #include "prerror.h" -PR_IMPLEMENT(PROrderedLock *) - PR_CreateOrderedLock( +PR_IMPLEMENT(PROrderedLock *) + PR_CreateOrderedLock( PRInt32 order, const char *name ) @@ -25,9 +25,9 @@ PR_IMPLEMENT(PROrderedLock *) } /* end PR_CreateOrderedLock() */ -PR_IMPLEMENT(void) - PR_DestroyOrderedLock( - PROrderedLock *lock +PR_IMPLEMENT(void) + PR_DestroyOrderedLock( + PROrderedLock *lock ) { PR_NOT_REACHED("Not implemented"); /* Not implemented yet */ @@ -35,9 +35,9 @@ PR_IMPLEMENT(void) } /* end PR_DestroyOrderedLock() */ -PR_IMPLEMENT(void) - PR_LockOrderedLock( - PROrderedLock *lock +PR_IMPLEMENT(void) + PR_LockOrderedLock( + PROrderedLock *lock ) { PR_NOT_REACHED("Not implemented"); /* Not implemented yet */ @@ -45,9 +45,9 @@ PR_IMPLEMENT(void) } /* end PR_LockOrderedLock() */ -PR_IMPLEMENT(PRStatus) - PR_UnlockOrderedLock( - PROrderedLock *lock +PR_IMPLEMENT(PRStatus) + PR_UnlockOrderedLock( + PROrderedLock *lock ) { PR_NOT_REACHED("Not implemented"); /* Not implemented yet */ diff --git a/pr/src/misc/prrng.c b/pr/src/misc/prrng.c index b5c38f82..1597293c 100644 --- a/pr/src/misc/prrng.c +++ b/pr/src/misc/prrng.c @@ -16,10 +16,10 @@ #include <string.h> #endif -PRSize _pr_CopyLowBits( - void *dst, - PRSize dstlen, - void *src, +PRSize _pr_CopyLowBits( + void *dst, + PRSize dstlen, + void *src, PRSize srclen ) { if (srclen <= dstlen) { @@ -32,9 +32,9 @@ PRSize _pr_CopyLowBits( memcpy(dst, src, dstlen); #endif return dstlen; -} +} -PR_IMPLEMENT(PRSize) PR_GetRandomNoise( +PR_IMPLEMENT(PRSize) PR_GetRandomNoise( void *buf, PRSize size ) diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c index cdbbe2a5..fe424491 100644 --- a/pr/src/misc/prsystem.c +++ b/pr/src/misc/prsystem.c @@ -106,7 +106,7 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle break; } len += 1; - } + } #endif break; @@ -159,7 +159,7 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle /* ** PR_GetNumberOfProcessors() -** +** ** Implementation notes: ** Every platform does it a bit different. ** numCpus is the returned value. @@ -169,7 +169,7 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle ** order of the if defined()s may be important, ** especially for unix variants. Do platform ** specific implementations before XP_UNIX. -** +** */ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void ) { @@ -244,14 +244,14 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void ) /* ** PR_GetPhysicalMemorySize() -** +** ** Implementation notes: ** Every platform does it a bit different. ** bytes is the returned value. ** for each platform's "if defined" section ** declare your local variable ** do your thing, assign to bytes. -** +** */ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) { diff --git a/pr/src/misc/prthinfo.c b/pr/src/misc/prthinfo.c index 2477899c..cdc24276 100644 --- a/pr/src/misc/prthinfo.c +++ b/pr/src/misc/prthinfo.c @@ -86,7 +86,7 @@ PR_ThreadScanStackPointers(PRThread* t, { prword_t scan; prword_t limit; - + scan = (prword_t) sp; limit = (prword_t) esp; while (scan < limit) { @@ -124,7 +124,7 @@ PR_ThreadScanStackPointers(PRThread* t, if (status != PR_SUCCESS) return status; } - + return PR_SUCCESS; } diff --git a/pr/src/misc/prtime.c b/pr/src/misc/prtime.c index 92079597..8b9f4a91 100644 --- a/pr/src/misc/prtime.c +++ b/pr/src/misc/prtime.c @@ -21,7 +21,7 @@ #include <errno.h> /* for EINVAL */ #include <time.h> -/* +/* * The COUNT_LEAPS macro counts the number of leap years passed by * till the start of the given year Y. At the start of the year 4 * A.D. the number of leap years passed by is 0, while at the start of @@ -241,7 +241,7 @@ PR_ImplodeTime(const PRExplodedTime *exploded) PR_NormalizeTime(©, PR_GMTParameters); numDays = DAYS_BETWEEN_YEARS(1970, copy.tm_year); - + numSecs = copy.tm_yday * 86400 + copy.tm_hour * 3600 + copy.tm_min * 60 + copy.tm_sec; @@ -443,7 +443,7 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params) /* Recompute yday and wday */ time->tm_yday = time->tm_mday + lastDayOfMonth[IsLeapYear(time->tm_year)][time->tm_month]; - + numDays = DAYS_BETWEEN_YEARS(1970, time->tm_year) + time->tm_yday; time->tm_wday = (numDays + 4) % 7; if (time->tm_wday < 0) { @@ -463,7 +463,7 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params) *------------------------------------------------------------------------- * * PR_LocalTimeParameters -- - * + * * returns the time parameters for the local time zone * * The following uses localtime() from the standard C library. @@ -480,7 +480,7 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params) * In this case we could define the macro as * #define MT_safe_localtime(timer, result) \ * (localtime_r(timer, result) == 0 ? result : NULL) - * I chose to compare the return value of localtime_r with -1 so + * I chose to compare the return value of localtime_r with -1 so * that I can catch the cases where localtime_r returns a pointer * to struct tm. The macro definition above would not be able to * detect such mistakes because it is legal to compare a pointer @@ -538,7 +538,7 @@ static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result) * clock plus ULONG_MAX. So we also have to check for the invalid * structs returned for timezones west of Greenwich when clock == 0. */ - + tmPtr = localtime(clock); #if defined(WIN16) || defined(XP_OS2) @@ -629,7 +629,7 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt) /* GMT is 00:00:00, 2nd of Jan. */ - offset2Jan1970 = (PRInt32)localTime.tm_sec + offset2Jan1970 = (PRInt32)localTime.tm_sec + 60L * (PRInt32)localTime.tm_min + 3600L * (PRInt32)localTime.tm_hour + 86400L * (PRInt32)((PRInt32)localTime.tm_mday - 2L); @@ -683,7 +683,7 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt) } /* - * dayOffset is the offset between local time and GMT in + * dayOffset is the offset between local time and GMT in * the day component, which can only be -1, 0, or 1. We * use the day of the week to compute dayOffset. */ @@ -732,7 +732,7 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt) retVal.tp_dst_offset = 3600; } } - + return retVal; } @@ -751,26 +751,26 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt) /* * Returns the mday of the first sunday of the month, where * mday and wday are for a given day in the month. - * mdays start with 1 (e.g. 1..31). + * mdays start with 1 (e.g. 1..31). * wdays start with 0 and are in the range 0..6. 0 = Sunday. */ #define firstSunday(mday, wday) (((mday - wday + 7 - 1) % 7) + 1) /* - * Returns the mday for the N'th Sunday of the month, where + * Returns the mday for the N'th Sunday of the month, where * mday and wday are for a given day in the month. - * mdays start with 1 (e.g. 1..31). + * mdays start with 1 (e.g. 1..31). * wdays start with 0 and are in the range 0..6. 0 = Sunday. * N has the following values: 0 = first, 1 = second (etc), -1 = last. - * ndays is the number of days in that month, the same value as the + * ndays is the number of days in that month, the same value as the * mday of the last day of the month. */ -static PRInt32 -NthSunday(PRInt32 mday, PRInt32 wday, PRInt32 N, PRInt32 ndays) +static PRInt32 +NthSunday(PRInt32 mday, PRInt32 wday, PRInt32 N, PRInt32 ndays) { PRInt32 firstSun = firstSunday(mday, wday); - if (N < 0) + if (N < 0) N = (ndays - firstSun) / 7; return firstSun + (7 * N); } @@ -837,8 +837,8 @@ PR_USPacificTimeParameters(const PRExplodedTime *gmt) if (st.tm_month < dst->dst_start_month) { retVal.tp_dst_offset = 0L; } else if (st.tm_month == dst->dst_start_month) { - int NthSun = NthSunday(st.tm_mday, st.tm_wday, - dst->dst_start_Nth_Sunday, + int NthSun = NthSunday(st.tm_mday, st.tm_wday, + dst->dst_start_Nth_Sunday, dst->dst_start_month_ndays); if (st.tm_mday < NthSun) { /* Before starting Sunday */ retVal.tp_dst_offset = 0L; @@ -855,8 +855,8 @@ PR_USPacificTimeParameters(const PRExplodedTime *gmt) } else if (st.tm_month < dst->dst_end_month) { retVal.tp_dst_offset = 3600L; } else if (st.tm_month == dst->dst_end_month) { - int NthSun = NthSunday(st.tm_mday, st.tm_wday, - dst->dst_end_Nth_Sunday, + int NthSun = NthSunday(st.tm_mday, st.tm_wday, + dst->dst_end_Nth_Sunday, dst->dst_end_month_ndays); if (st.tm_mday < NthSun) { /* Before ending Sunday */ retVal.tp_dst_offset = 3600L; @@ -1484,7 +1484,7 @@ PR_ParseTimeStringToExplodedTime( /* "-" is ignored at the beginning of a token if we have not yet parsed a year (e.g., the second "-" in "30-AUG-1966"), or if - the character after the dash is not a digit. */ + the character after the dash is not a digit. */ if (*rest == '-' && ((rest > string && isalpha((unsigned char)rest[-1]) && year < 0) || rest[1] < '0' || rest[1] > '9')) @@ -1574,14 +1574,14 @@ PR_ParseTimeStringToExplodedTime( * time, we call mktime(). However, we need to see if we are * on 1-Jan-1970 or before. If we are, we can't call mktime() * because mktime() will crash on win16. In that case, we - * calculate zone_offset based on the zone offset at + * calculate zone_offset based on the zone offset at * 00:00:00, 2 Jan 1970 GMT, and subtract zone_offset from the * date we are parsing to transform the date to GMT. We also * do so if mktime() returns (time_t) -1 (time out of range). */ /* month, day, hours, mins and secs are always non-negative - so we dont need to worry about them. */ + so we dont need to worry about them. */ if(result->tm_year >= 1970) { PRInt64 usec_per_sec; @@ -1602,7 +1602,7 @@ PR_ParseTimeStringToExplodedTime( /* * mktime will return (time_t) -1 if the input is a date * after 23:59:59, December 31, 3000, US Pacific Time (not - * UTC as documented): + * UTC as documented): * http://msdn.microsoft.com/en-us/library/d1y53h2a(VS.80).aspx * But if the year is 3001, mktime also invokes the invalid * parameter handler, causing the application to crash. This @@ -1633,7 +1633,7 @@ PR_ParseTimeStringToExplodedTime( return PR_SUCCESS; } } - + /* So mktime() can't handle this case. We assume the zone_offset for the date we are parsing is the same as the zone offset on 00:00:00 2 Jan 1970 GMT. */ @@ -1765,7 +1765,7 @@ static const char* abbrevMonths[] = }; static const char* months[] = -{ +{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; @@ -1824,17 +1824,17 @@ static unsigned int pr_WeekOfYear(const PRExplodedTime* time, * needed to write things like MIME headers which must always be in US English. * **********************************************************************************/ - + PR_IMPLEMENT(PRUint32) PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize, const char* format, const PRExplodedTime* time ) { char* bufPtr = buf; const char* fmtPtr; - char tmpBuf[ 40 ]; + char tmpBuf[ 40 ]; const int tmpBufSize = sizeof( tmpBuf ); - + for( fmtPtr=format; *fmtPtr != '\0'; fmtPtr++ ) { if( *fmtPtr != '%' ) @@ -1849,130 +1849,130 @@ PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize, /* escaped '%' character */ ADDCHAR( bufPtr, bufSize, '%' ); break; - + case 'a': /* abbreviated weekday name */ ADDSTR( bufPtr, bufSize, abbrevDays[ time->tm_wday ] ); break; - + case 'A': /* full weekday name */ ADDSTR( bufPtr, bufSize, days[ time->tm_wday ] ); break; - + case 'b': /* abbreviated month name */ ADDSTR( bufPtr, bufSize, abbrevMonths[ time->tm_month ] ); break; - + case 'B': /* full month name */ ADDSTR(bufPtr, bufSize, months[ time->tm_month ] ); break; - + case 'c': /* Date and time. */ PR_FormatTimeUSEnglish( tmpBuf, tmpBufSize, "%a %b %d %H:%M:%S %Y", time ); ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'd': /* day of month ( 01 - 31 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld",time->tm_mday ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; case 'H': /* hour ( 00 - 23 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld",time->tm_hour ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'I': /* hour ( 01 - 12 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld", (time->tm_hour%12) ? time->tm_hour%12 : (PRInt32) 12 ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'j': /* day number of year ( 001 - 366 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.3d",time->tm_yday + 1); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'm': /* month number ( 01 - 12 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld",time->tm_month+1); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'M': /* minute ( 00 - 59 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld",time->tm_min ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'p': /* locale's equivalent of either AM or PM */ - ADDSTR( bufPtr, bufSize, (time->tm_hour<12)?"AM":"PM" ); + ADDSTR( bufPtr, bufSize, (time->tm_hour<12)?"AM":"PM" ); break; - + case 'S': /* seconds ( 00 - 61 ), allows for leap seconds */ PR_snprintf(tmpBuf,tmpBufSize,"%.2ld",time->tm_sec ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'U': /* week number of year ( 00 - 53 ), Sunday is the first day of week 1 */ PR_snprintf(tmpBuf,tmpBufSize,"%.2d", pr_WeekOfYear( time, 0 ) ); ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'w': /* weekday number ( 0 - 6 ), Sunday = 0 */ PR_snprintf(tmpBuf,tmpBufSize,"%d",time->tm_wday ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'W': /* Week number of year ( 00 - 53 ), Monday is the first day of week 1 */ PR_snprintf(tmpBuf,tmpBufSize,"%.2d", pr_WeekOfYear( time, 1 ) ); ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'x': /* Date representation */ PR_FormatTimeUSEnglish( tmpBuf, tmpBufSize, "%m/%d/%y", time ); ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'X': /* Time representation. */ PR_FormatTimeUSEnglish( tmpBuf, tmpBufSize, "%H:%M:%S", time ); ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'y': /* year within century ( 00 - 99 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.2d",time->tm_year % 100 ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'Y': /* year as ccyy ( for example 1986 ) */ PR_snprintf(tmpBuf,tmpBufSize,"%.4d",time->tm_year ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; - + case 'Z': /* Time zone name or no characters if no time zone exists. * Since time zone name is supposed to be independant of locale, we * defer to PR_FormatTime() for this option. */ PR_FormatTime( tmpBuf, tmpBufSize, "%Z", time ); - ADDSTR( bufPtr, bufSize, tmpBuf ); + ADDSTR( bufPtr, bufSize, tmpBuf ); break; default: @@ -1980,7 +1980,7 @@ PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize, ADDCHAR( bufPtr, bufSize, '%' ); ADDCHAR( bufPtr, bufSize, *fmtPtr ); break; - + } } } @@ -1997,7 +1997,7 @@ PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize, * Returns the week number of the year (0-53) for the given time. firstDayOfWeek * is the day on which the week is considered to start (0=Sun, 1=Mon, ...). * Week 1 starts the first time firstDayOfWeek occurs in the year. In other words, - * a partial week at the start of the year is considered week 0. + * a partial week at the start of the year is considered week 0. * **********************************************************************************/ diff --git a/pr/src/misc/prtpool.c b/pr/src/misc/prtpool.c index c2cc9c80..05867ea7 100644 --- a/pr/src/misc/prtpool.c +++ b/pr/src/misc/prtpool.c @@ -107,7 +107,7 @@ struct PRJob { PRIntervalTime timeout; /* relative value */ PRIntervalTime absolute; #ifdef OPT_WINNT - NT_notifier nt_notifier; + NT_notifier nt_notifier; #endif }; @@ -148,7 +148,7 @@ static void notify_timerq(PRThreadPool *tp); * tp->ioq.lock,tp->timerq.lock * | * V - * tp->jobq->lock + * tp->jobq->lock */ /* @@ -174,7 +174,7 @@ PRCList *head; PR_Unlock(tp->jobq.lock); rv = GetQueuedCompletionStatus(tp->jobq.nt_completion_port, &unused, &shutdown, &olp, INFINITE); - + PR_ASSERT(rv); if (shutdown) break; @@ -190,7 +190,7 @@ PRCList *head; tp->idle_threads++; PR_WaitCondVar(tp->jobq.cv, PR_INTERVAL_NO_TIMEOUT); tp->idle_threads--; - } + } if (tp->shutdown) { PR_Unlock(tp->jobq.lock); break; @@ -396,8 +396,8 @@ PRIntervalTime now; for(index = 1; index < (pollfds_used); index++) { PRInt16 events = pollfds[index].in_flags; - PRInt16 revents = pollfds[index].out_flags; - jobp = polljobs[index]; + PRInt16 revents = pollfds[index].out_flags; + jobp = polljobs[index]; if ((revents & PR_POLL_NVAL) || /* busted in all cases */ (revents & PR_POLL_ERR) || @@ -419,7 +419,7 @@ PRIntervalTime now; jobp->iod->error = PR_BAD_DESCRIPTOR_ERROR; else if (PR_POLL_HUP & revents) jobp->iod->error = PR_CONNECT_RESET_ERROR; - else + else jobp->iod->error = PR_IO_ERROR; /* @@ -518,7 +518,7 @@ PRIntervalTime now; /* * move expired-timer jobs to jobq */ - now = PR_IntervalNow(); + now = PR_IntervalNow(); while (!PR_CLIST_IS_EMPTY(&tp->timerq.list)) { qp = tp->timerq.list.next; jobp = JOB_LINKS_PTR(qp); @@ -704,7 +704,7 @@ alloc_job(PRBool joinable, PRThreadPool *tp) PRJob *jobp; jobp = PR_NEWZAP(PRJob); - if (NULL == jobp) + if (NULL == jobp) goto failed; if (joinable) { jobp->join_cv = PR_NewCondVar(tp->join_lock); diff --git a/pr/src/misc/prtrace.c b/pr/src/misc/prtrace.c index 058f700b..0b916902 100644 --- a/pr/src/misc/prtrace.c +++ b/pr/src/misc/prtrace.c @@ -85,18 +85,18 @@ static PRCondVar *logCVar; /* Sync Condidtion Variable */ ** Inter-thread state communication. ** Controling thread writes to logOrder under protection of logCVar ** the logging thread reads logOrder and sets logState on Notify. -** +** ** logSegments, logCount, logLostData must be read and written under ** protection of logLock, logCVar. -** +** */ static enum LogState { LogNotRunning, /* Initial state */ LogReset, /* Causes logger to re-calc controls */ LogActive, /* Logging in progress, set only by log thread */ - LogSuspend, /* Suspend Logging */ - LogResume, /* Resume Logging => LogActive */ + LogSuspend, /* Suspend Logging */ + LogResume, /* Resume Logging => LogActive */ LogStop /* Stop the log thread */ } logOrder, logState, localState; /* controlling state variables */ static PRInt32 logSegments; /* Number of buffer segments */ @@ -139,7 +139,7 @@ static void NewTraceBuffer( PRInt32 size ) PR_LOG( lm, PR_LOG_ERROR, ("PRTrace: Failed to get trace buffer")); PR_ASSERT( 0 ); - } + } else { PR_LOG( lm, PR_LOG_NOTICE, @@ -166,7 +166,7 @@ static void _PR_InitializeTrace( void ) PR_ASSERT( traceLock != NULL ); PR_Lock( traceLock ); - + PR_INIT_CLIST( &qNameList ); lm = PR_NewLogModule("trace"); @@ -179,14 +179,14 @@ static void _PR_InitializeTrace( void ) logCVar = PR_NewCondVar( logLock ); PR_Unlock( traceLock ); - return; + return; } /* end _PR_InitializeTrace() */ /* ** Create a Trace Handle */ PR_IMPLEMENT(PRTraceHandle) - PR_CreateTrace( + PR_CreateTrace( const char *qName, /* QName for this trace handle */ const char *rName, /* RName for this trace handle */ const char *description /* description for this trace handle */ @@ -234,10 +234,10 @@ PR_IMPLEMENT(PRTraceHandle) { qnp = PR_NEWZAP( QName ); PR_ASSERT( qnp != NULL ); - PR_INIT_CLIST( &qnp->link ); - PR_INIT_CLIST( &qnp->rNameList ); + PR_INIT_CLIST( &qnp->link ); + PR_INIT_CLIST( &qnp->rNameList ); strcpy( qnp->name, qName ); - PR_APPEND_LINK( &qnp->link, &qNameList ); + PR_APPEND_LINK( &qnp->link, &qNameList ); } /* Do we already have a matching RName? */ @@ -267,7 +267,7 @@ PR_IMPLEMENT(PRTraceHandle) PR_ASSERT(0); } - PR_APPEND_LINK( &rnp->link, &qnp->rNameList ); /* add RName to QName's rnList */ + PR_APPEND_LINK( &rnp->link, &qnp->rNameList ); /* add RName to QName's rnList */ rnp->qName = qnp; /* point the RName to the QName */ /* Unlock the Facility */ @@ -281,15 +281,15 @@ PR_IMPLEMENT(PRTraceHandle) /* ** */ -PR_IMPLEMENT(void) - PR_DestroyTrace( +PR_IMPLEMENT(void) + PR_DestroyTrace( PRTraceHandle handle /* Handle to be destroyed */ ) { RName *rnp = (RName *)handle; QName *qnp = rnp->qName; - PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting: QName: %s, RName: %s", + PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting: QName: %s, RName: %s", qnp->name, rnp->name)); /* Lock the Facility */ @@ -299,7 +299,7 @@ PR_IMPLEMENT(void) ** Remove RName from the list of RNames in QName ** and free RName */ - PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting RName: %s, %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting RName: %s, %p", rnp->name, rnp)); PR_REMOVE_LINK( &rnp->link ); PR_Free( rnp->lock ); @@ -311,11 +311,11 @@ PR_IMPLEMENT(void) */ if ( PR_CLIST_IS_EMPTY( &qnp->rNameList ) ) { - PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting unused QName: %s, %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: Deleting unused QName: %s, %p", qnp->name, qnp)); PR_REMOVE_LINK( &qnp->link ); PR_DELETE( qnp ); - } + } /* Unlock the Facility */ PR_Unlock( traceLock ); @@ -325,8 +325,8 @@ PR_IMPLEMENT(void) /* ** Create a TraceEntry in the trace buffer */ -PR_IMPLEMENT(void) - PR_Trace( +PR_IMPLEMENT(void) + PR_Trace( PRTraceHandle handle, /* use this trace handle */ PRUint32 userData0, /* User supplied data word 0 */ PRUint32 userData1, /* User supplied data word 1 */ @@ -341,8 +341,8 @@ PR_IMPLEMENT(void) PRTraceEntry *tep; PRInt32 mark; - if ( (traceState == Suspended ) - || ( ((RName *)handle)->state == Suspended )) + if ( (traceState == Suspended ) + || ( ((RName *)handle)->state == Suspended )) return; /* @@ -350,14 +350,14 @@ PR_IMPLEMENT(void) */ PR_Lock( traceLock ); - tep = &tBuf[next++]; + tep = &tBuf[next++]; if ( next > last ) next = 0; if ( fetchLostData == PR_FALSE && next == fetchLastSeen ) fetchLostData = PR_TRUE; - + mark = next; - + PR_Unlock( traceLock ); /* @@ -400,8 +400,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_SetTraceOption( +PR_IMPLEMENT(void) + PR_SetTraceOption( PRTraceOption command, /* One of the enumerated values */ void *value /* command value or NULL */ ) @@ -419,33 +419,33 @@ PR_IMPLEMENT(void) PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceBufSize: %ld", bufSize)); break; - + case PRTraceEnable : rnp = *(RName **)value; rnp->state = Running; PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceEnable: %p", rnp)); break; - + case PRTraceDisable : rnp = *(RName **)value; rnp->state = Suspended; PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceDisable: %p", rnp)); break; - + case PRTraceSuspend : traceState = Suspended; PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceSuspend")); break; - + case PRTraceResume : traceState = Running; PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceResume")); break; - + case PRTraceSuspendRecording : PR_Lock( logLock ); logOrder = LogSuspend; @@ -454,7 +454,7 @@ PR_IMPLEMENT(void) PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceSuspendRecording")); break; - + case PRTraceResumeRecording : PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceResumeRecording")); @@ -465,7 +465,7 @@ PR_IMPLEMENT(void) PR_NotifyCondVar( logCVar ); PR_Unlock( logLock ); break; - + case PRTraceStopRecording : PR_Lock( logLock ); logOrder = LogStop; @@ -480,7 +480,7 @@ PR_IMPLEMENT(void) ("PRSetTraceOption: PRTraceLockTraceHandles")); PR_Lock( traceLock ); break; - + case PRTraceUnLockHandles : PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceUnLockHandles")); @@ -499,8 +499,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(void) - PR_GetTraceOption( +PR_IMPLEMENT(void) + PR_GetTraceOption( PRTraceOption command, /* One of the enumerated values */ void *value /* command value or NULL */ ) @@ -512,7 +512,7 @@ PR_IMPLEMENT(void) PR_LOG( lm, PR_LOG_DEBUG, ("PRGetTraceOption: PRTraceBufSize: %ld", bufSize )); break; - + default: PR_LOG( lm, PR_LOG_ERROR, ("PRGetTraceOption: Invalid command %ld", command )); @@ -525,8 +525,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(PRTraceHandle) - PR_GetTraceHandleFromName( +PR_IMPLEMENT(PRTraceHandle) + PR_GetTraceHandleFromName( const char *qName, /* QName search argument */ const char *rName /* RName search argument */ ) @@ -564,8 +564,8 @@ foundIt: /* ** */ -PR_IMPLEMENT(void) - PR_GetTraceNameFromHandle( +PR_IMPLEMENT(void) + PR_GetTraceNameFromHandle( PRTraceHandle handle, /* handle as search argument */ const char **qName, /* pointer to associated QName */ const char **rName, /* pointer to associated RName */ @@ -580,7 +580,7 @@ PR_IMPLEMENT(void) *description = rnp->desc; PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: GetConterNameFromHandle: " - "QNp: %p, RNp: %p,\n\tQName: %s, RName: %s, Desc: %s", + "QNp: %p, RNp: %p,\n\tQName: %s, RName: %s, Desc: %s", qnp, rnp, qnp->name, rnp->name, rnp->desc )); return; @@ -589,8 +589,8 @@ PR_IMPLEMENT(void) /* ** */ -PR_IMPLEMENT(PRTraceHandle) - PR_FindNextTraceQname( +PR_IMPLEMENT(PRTraceHandle) + PR_FindNextTraceQname( PRTraceHandle handle ) { @@ -602,10 +602,10 @@ PR_IMPLEMENT(PRTraceHandle) qnp = (QName *)PR_LIST_HEAD( &qNameList ); else if ( PR_NEXT_LINK( &qnp->link ) == &qNameList ) qnp = NULL; - else + else qnp = (QName *)PR_NEXT_LINK( &qnp->link ); - PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: FindNextQname: Handle: %p, Returns: %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: FindNextQname: Handle: %p, Returns: %p", handle, qnp )); return((PRTraceHandle)qnp); @@ -614,8 +614,8 @@ PR_IMPLEMENT(PRTraceHandle) /* ** */ -PR_IMPLEMENT(PRTraceHandle) - PR_FindNextTraceRname( +PR_IMPLEMENT(PRTraceHandle) + PR_FindNextTraceRname( PRTraceHandle rhandle, PRTraceHandle qhandle ) @@ -633,12 +633,12 @@ PR_IMPLEMENT(PRTraceHandle) else rnp = (RName *)PR_NEXT_LINK( &rnp->link ); - PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: FindNextRname: Rhandle: %p, QHandle: %p, Returns: %p", + PR_LOG( lm, PR_LOG_DEBUG, ("PRTrace: FindNextRname: Rhandle: %p, QHandle: %p, Returns: %p", rhandle, qhandle, rnp )); return((PRTraceHandle)rnp); } /* end PR_FindNextTraceRname() */ - + /* ** */ @@ -665,13 +665,13 @@ static PRFileDesc * InitializeRecording( void ) ("RecordTraceEntries: Environment variable not defined. Exiting")); return NULL; } - + /* Open the logfile */ logFile = PR_Open( logFileName, PR_WRONLY | PR_CREATE_FILE, 0666 ); if ( logFile == NULL ) { PR_LOG( lm, PR_LOG_ERROR, - ("RecordTraceEntries: Cannot open %s as trace log file. OS error: %ld", + ("RecordTraceEntries: Cannot open %s as trace log file. OS error: %ld", logFileName, PR_GetOSError())); return NULL; } @@ -735,7 +735,7 @@ static void WriteTraceSegment( PRFileDesc *logFile, void *buf, PRInt32 amount ) else if ( rc != amount ) PR_LOG( lm, PR_LOG_ERROR, ("RecordTraceEntries: PR_Write() Tried to write: %ld, Wrote: %ld", amount, rc)); - else + else PR_LOG( lm, PR_LOG_DEBUG, ("RecordTraceEntries: PR_Write(): Buffer: %p, bytes: %ld", buf, amount)); @@ -747,7 +747,7 @@ static void WriteTraceSegment( PRFileDesc *logFile, void *buf, PRInt32 amount ) */ PR_IMPLEMENT(void) PR_RecordTraceEntries( - void + void ) { PRFileDesc *logFile; @@ -831,14 +831,14 @@ PR_IMPLEMENT(PRIntn) PRInt32 *found /* number you got */ ) { - PRInt32 rc; + PRInt32 rc; PRInt32 copied = 0; - + PR_Lock( traceLock ); - + /* ** Depending on where the LastSeen and Next indices are, - ** copy the trace buffer in one or two pieces. + ** copy the trace buffer in one or two pieces. */ PR_LOG( lm, PR_LOG_ERROR, ("PR_GetTraceEntries: Next: %ld, LastSeen: %ld", next, fetchLastSeen)); |