Changeset 102000 in vbox
- Timestamp:
- Nov 8, 2023 6:30:47 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/priometh.c
r101872 r102000 39 39 40 40 #include <string.h> 41 #include <iprt/assert.h> 41 42 42 43 /*****************************************************************************/ … … 78 79 PRIntn _PR_InvalidInt(void) 79 80 { 80 PR_ASSERT(!"I/O method is invalid");81 Assert(!"I/O method is invalid"); 81 82 PR_SetError(PR_INVALID_METHOD_ERROR, 0); 82 83 return -1; … … 85 86 PRInt16 _PR_InvalidInt16(void) 86 87 { 87 PR_ASSERT(!"I/O method is invalid");88 Assert(!"I/O method is invalid"); 88 89 PR_SetError(PR_INVALID_METHOD_ERROR, 0); 89 90 return -1; … … 94 95 PRInt64 rv; 95 96 LL_I2L(rv, -1); 96 PR_ASSERT(!"I/O method is invalid");97 Assert(!"I/O method is invalid"); 97 98 PR_SetError(PR_INVALID_METHOD_ERROR, 0); 98 99 return rv; … … 105 106 PRStatus _PR_InvalidStatus(void) 106 107 { 107 PR_ASSERT(!"I/O method is invalid");108 Assert(!"I/O method is invalid"); 108 109 PR_SetError(PR_INVALID_METHOD_ERROR, 0); 109 110 return PR_FAILURE; … … 116 117 PRFileDesc *_PR_InvalidDesc(void) 117 118 { 118 PR_ASSERT(!"I/O method is invalid");119 Assert(!"I/O method is invalid"); 119 120 PR_SetError(PR_INVALID_METHOD_ERROR, 0); 120 121 return NULL; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prmmap.c
r1 r102000 46 46 #include "primpl.h" 47 47 48 #include <iprt/assert.h> 49 48 50 PR_IMPLEMENT(PRFileMap *) PR_CreateFileMap( 49 51 PRFileDesc *fd, … … 53 55 PRFileMap *fmap; 54 56 55 PR_ASSERT(prot == PR_PROT_READONLY || prot == PR_PROT_READWRITE56 57 Assert(prot == PR_PROT_READONLY || prot == PR_PROT_READWRITE 58 || prot == PR_PROT_WRITECOPY); 57 59 fmap = PR_NEWZAP(PRFileMap); 58 60 if (NULL == fmap) { -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prprf.c
r51833 r102000 48 48 #include "prprf.h" 49 49 #include "prlong.h" 50 #include "prlog.h"51 50 #include "prmem.h" 51 52 #include <iprt/assert.h> 52 53 53 54 /* … … 351 352 const char *p = fin; 352 353 while (*p) { 353 PR_ASSERT(*p != 'L');354 Assert(*p != 'L'); 354 355 p++; 355 356 } … … 568 569 case 'G': 569 570 /* XXX not supported I suppose */ 570 PR_ASSERT(0);571 Assert(0); 571 572 nas[ cn ].type = TYPE_UNKNOWN; 572 573 break; … … 581 582 582 583 default: 583 PR_ASSERT(0);584 Assert(0); 584 585 nas[ cn ].type = TYPE_UNKNOWN; 585 586 break; … … 701 702 if( rv < 0 ){ 702 703 /* the fmt contains error Numbered Argument format, [email protected] */ 703 PR_ASSERT(0);704 Assert(0); 704 705 return rv; 705 706 } … … 954 955 type = TYPE_UINTN; 955 956 } else { 956 PR_ASSERT(0);957 Assert(0); 957 958 break; 958 959 } … … 966 967 case 'G': 967 968 /* XXX not supported I suppose */ 968 PR_ASSERT(0);969 Assert(0); 969 970 break; 970 971 #endif … … 988 989 /* Not a % token after all... skip it */ 989 990 #if 0 990 PR_ASSERT(0);991 Assert(0); 991 992 #endif 992 993 rv = (*ss->stuff)(ss, "%", 1); … … 1084 1085 *ss->cur++ = *sp++; 1085 1086 } 1086 PR_ASSERT((PRUint32)(ss->cur - ss->base) <= ss->maxlen);1087 Assert((PRUint32)(ss->cur - ss->base) <= ss->maxlen); 1087 1088 return 0; 1088 1089 } … … 1155 1156 PRUint32 rv; 1156 1157 1157 PR_ASSERT((PRInt32)outlen > 0);1158 Assert((PRInt32)outlen > 0); 1158 1159 if ((PRInt32)outlen <= 0) { 1159 1160 return 0; … … 1172 1173 PRUint32 n; 1173 1174 1174 PR_ASSERT((PRInt32)outlen > 0);1175 Assert((PRInt32)outlen > 0); 1175 1176 if ((PRInt32)outlen <= 0) { 1176 1177 return 0; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prscanf.c
r1 r102000 54 54 #include "prprf.h" 55 55 #include "prdtoa.h" 56 #include "prlog.h"57 56 #include "prerror.h" 57 58 #include <iprt/assert.h> 58 59 59 60 /* … … 142 143 const char *digitStart; 143 144 144 PR_ASSERT(base == 0 || base == 8 || base == 10 || base == 16);145 Assert(base == 0 || base == 8 || base == 10 || base == 16); 145 146 if (base < 0 || base == 1 || base > BASE_MAX) { 146 147 if (endptr) { … … 177 178 } 178 179 } 179 PR_ASSERT(base != 0);180 Assert(base != 0); 180 181 LL_I2L(base64, base); 181 182 digitStart = cPtr; … … 280 281 dlen = 8; 281 282 } else { 282 PR_ASSERT(base == 16);283 Assert(base == 16); 283 284 dlen = 16 + 6; /* 16 digits, plus 6 in uppercase */ 284 285 } … … 483 484 break; 484 485 default: 485 PR_ASSERT(0);486 Assert(0); 486 487 } 487 488 } -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/unix.c
r101929 r102000 66 66 67 67 #ifdef VBOX 68 # include <iprt/assert.h> 68 69 # include <iprt/mem.h> 69 70 #endif … … 98 99 int flags; 99 100 100 PR_ASSERT(_PR_TRI_UNKNOWN == fd->secret->inheritable);101 Assert(_PR_TRI_UNKNOWN == fd->secret->inheritable); 101 102 flags = fcntl(fd->secret->md.osfd, F_GETFD, 0); 102 PR_ASSERT(-1 != flags);103 Assert(-1 != flags); 103 104 fd->secret->inheritable = (flags & FD_CLOEXEC) ? 104 105 _PR_TRI_FALSE : _PR_TRI_TRUE; … … 524 525 sigact.sa_flags = 0; 525 526 rv = sigaction(SIGPIPE, &sigact, 0); 526 PR_ASSERT(0 == rv);527 Assert(0 == rv); 527 528 528 529 _PR_InitIOV(); /* one last hack */ … … 721 722 } 722 723 } 723 PR_ASSERT(rv > 0);724 Assert(rv > 0); 724 725 } else if (rv == -1 && errno == EBADF) { 725 726 rv = 0; … … 734 735 } 735 736 } 736 PR_ASSERT(rv > 0);737 } 738 PR_ASSERT(-1 != timeout || rv != 0);737 Assert(rv > 0); 738 } 739 Assert(-1 != timeout || rv != 0); 739 740 740 741 return rv; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinrval.c
r1 r102000 43 43 #include "primpl.h" 44 44 45 #include <iprt/assert.h> 46 45 47 /* 46 48 *----------------------------------------------------------------------- … … 59 61 PRIntervalTime ticksPerSec = PR_TicksPerSecond(); 60 62 61 PR_ASSERT(ticksPerSec >= PR_INTERVAL_MIN);62 PR_ASSERT(ticksPerSec <= PR_INTERVAL_MAX);63 Assert(ticksPerSec >= PR_INTERVAL_MIN); 64 Assert(ticksPerSec <= PR_INTERVAL_MAX); 63 65 } 64 66 #endif /* DEBUG */ -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prtime.c
r101973 r102000 47 47 #include "prlock.h" 48 48 #include "prprf.h" 49 #include "prlog.h"50 49 51 50 #include <string.h> 52 51 #include <ctype.h> 52 53 #include <iprt/assert.h> 53 54 54 55 /* … … 948 949 #endif 949 950 950 PR_ASSERT(string && result);951 Assert(string && result); 951 952 if (!string || !result) return PR_FAILURE; 952 953 … … 957 958 if (iterations++ > 1000) 958 959 { 959 PR_ASSERT(0);960 Assert(0); 960 961 return PR_FAILURE; 961 962 } … … 1477 1478 case TT_JST: zone_offset = 9 * 60; break; 1478 1479 default: 1479 PR_ASSERT(0);1480 Assert (0); 1480 1481 break; 1481 1482 } … … 1519 1520 time_t secs; 1520 1521 1521 PR_ASSERT(tm.tm_month > -11522 Assert(tm.tm_month > -1 1522 1523 && tm.tm_mday > 0 1523 1524 && tm.tm_hour > -1 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
r101982 r102000 79 79 #endif 80 80 81 #include <iprt/assert.h> 81 82 #include <iprt/thread.h> 82 83 … … 307 308 PRThread *self = PR_GetCurrentThread(); 308 309 309 PR_ASSERT(PR_INTERVAL_NO_WAIT != op->timeout);310 Assert(PR_INTERVAL_NO_WAIT != op->timeout); 310 311 311 312 switch (op->timeout) { … … 445 446 */ 446 447 pt_poll_now(op); 447 PR_ASSERT(pt_continuation_done == op->status);448 Assert(pt_continuation_done == op->status); 448 449 return op->result.code; 449 450 } /* pt_Continue */ … … 649 650 650 651 _pr_rename_lock = PR_NewLock(); 651 PR_ASSERT(NULL != _pr_rename_lock);652 Assert(NULL != _pr_rename_lock); 652 653 653 654 _pr_stdin = pt_SetMethods(0, PR_DESC_FILE, PR_FALSE, PR_TRUE); 654 655 _pr_stdout = pt_SetMethods(1, PR_DESC_FILE, PR_FALSE, PR_TRUE); 655 656 _pr_stderr = pt_SetMethods(2, PR_DESC_FILE, PR_FALSE, PR_TRUE); 656 PR_ASSERT(_pr_stdin && _pr_stdout && _pr_stderr);657 Assert(_pr_stdin && _pr_stdout && _pr_stderr); 657 658 658 659 #ifdef DARWIN … … 697 698 { 698 699 PRFileDesc *result = NULL; 699 PR_ASSERT(osfd >= PR_StandardInput && osfd <= PR_StandardError);700 Assert(osfd >= PR_StandardInput && osfd <= PR_StandardError); 700 701 701 702 if (!_pr_initialized) _PR_ImplicitInitialization(); … … 863 864 864 865 /* Ensured by PR_Writev */ 865 PR_ASSERT(iov_len <= PR_MAX_IOVECTOR_SIZE);866 Assert(iov_len <= PR_MAX_IOVECTOR_SIZE); 866 867 867 868 /* … … 903 904 bytes -= osiov->iov_len; /* this one's done cooked */ 904 905 } 905 PR_ASSERT(osiov_len > 0 || bytes == 0);906 Assert(osiov_len > 0 || bytes == 0); 906 907 if (osiov_len > 0) 907 908 { … … 1027 1028 if (pt_TestAbort()) return PR_FAILURE; 1028 1029 1029 PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);1030 Assert(IsValidNetAddr(addr) == PR_TRUE); 1030 1031 addr_len = PR_NETADDR_SIZE(addr); 1031 1032 … … 1079 1080 if ((out_flags & (PR_POLL_WRITE | PR_POLL_EXCEPT | PR_POLL_ERR)) == 0) 1080 1081 { 1081 PR_ASSERT(out_flags == 0);1082 Assert(out_flags == 0); 1082 1083 PR_SetError(PR_IN_PROGRESS_ERROR, 0); 1083 1084 return PR_FAILURE; … … 1168 1169 else 1169 1170 { 1170 PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);1171 PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);1171 Assert(IsValidNetAddr(addr) == PR_TRUE); 1172 Assert(IsValidNetAddrLen(addr, addr_len) == PR_TRUE); 1172 1173 #ifdef LINUX 1173 1174 /* … … 1198 1199 if (pt_TestAbort()) return PR_FAILURE; 1199 1200 1200 PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);1201 Assert(IsValidNetAddr(addr) == PR_TRUE); 1201 1202 if (addr->raw.family == AF_UNIX) 1202 1203 { … … 1349 1350 */ 1350 1351 #if defined(SOLARIS) 1351 PR_ASSERT(0 == flags);1352 Assert(0 == flags); 1352 1353 retry: 1353 1354 bytes = write(fd->secret->md.osfd, PT_SENDBUF_CAST buf, tmp_amount); … … 1442 1443 #endif /* _PR_HAVE_SOCKADDR_LEN */ 1443 1444 1444 PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);1445 PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);1445 Assert(IsValidNetAddr(addr) == PR_TRUE); 1446 Assert(IsValidNetAddrLen(addr, addr_len) == PR_TRUE); 1446 1447 return PR_SUCCESS; 1447 1448 } … … 1470 1471 #endif /* _PR_HAVE_SOCKADDR_LEN */ 1471 1472 1472 PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);1473 PR_ASSERT(IsValidNetAddrLen(addr, addr_len) == PR_TRUE);1473 Assert(IsValidNetAddr(addr) == PR_TRUE); 1474 Assert(IsValidNetAddrLen(addr, addr_len) == PR_TRUE); 1474 1475 return PR_SUCCESS; 1475 1476 } … … 1503 1504 rv = getsockopt( 1504 1505 fd->secret->md.osfd, level, name, (char *) &linger, &length); 1505 PR_ASSERT((-1 == rv) || (sizeof(linger) == length));1506 Assert((-1 == rv) || (sizeof(linger) == length)); 1506 1507 data->value.linger.polarity = 1507 1508 (linger.l_onoff) ? PR_TRUE : PR_FALSE; … … 1519 1520 rv = getsockopt( 1520 1521 fd->secret->md.osfd, level, name, (char*)&value, &length); 1521 PR_ASSERT((-1 == rv) || (sizeof(PRIntn) == length));1522 Assert((-1 == rv) || (sizeof(PRIntn) == length)); 1522 1523 data->value.reuse_addr = (0 == value) ? PR_FALSE : PR_TRUE; 1523 1524 break; … … 1530 1531 fd->secret->md.osfd, level, name, 1531 1532 (char*)&xbool, &length); 1532 PR_ASSERT((-1 == rv) || (sizeof(xbool) == length));1533 Assert((-1 == rv) || (sizeof(xbool) == length)); 1533 1534 data->value.mcast_loopback = (0 == xbool) ? PR_FALSE : PR_TRUE; 1534 1535 break; … … 1542 1543 rv = getsockopt( 1543 1544 fd->secret->md.osfd, level, name, (char*)&value, &length); 1544 PR_ASSERT((-1 == rv) || (sizeof(PRIntn) == length));1545 Assert((-1 == rv) || (sizeof(PRIntn) == length)); 1545 1546 data->value.recv_buffer_size = value; 1546 1547 break; … … 1553 1554 fd->secret->md.osfd, level, name, 1554 1555 (char*)&data->value.ip_ttl, &length); 1555 PR_ASSERT((-1 == rv) || (sizeof(PRIntn) == length));1556 Assert((-1 == rv) || (sizeof(PRIntn) == length)); 1556 1557 break; 1557 1558 } … … 1563 1564 fd->secret->md.osfd, level, name, 1564 1565 (char*)&ttl, &length); 1565 PR_ASSERT((-1 == rv) || (sizeof(ttl) == length));1566 Assert((-1 == rv) || (sizeof(ttl) == length)); 1566 1567 data->value.mcast_ttl = ttl; 1567 1568 break; … … 1574 1575 rv = getsockopt( 1575 1576 fd->secret->md.osfd, level, name, (char*)&mreq, &length); 1576 PR_ASSERT((-1 == rv) || (sizeof(mreq) == length));1577 Assert((-1 == rv) || (sizeof(mreq) == length)); 1577 1578 data->value.add_member.mcaddr.inet.ip = 1578 1579 mreq.imr_multiaddr.s_addr; … … 1587 1588 fd->secret->md.osfd, level, name, 1588 1589 (char*)&data->value.mcast_if.inet.ip, &length); 1589 PR_ASSERT((-1 == rv)1590 Assert((-1 == rv) 1590 1591 || (sizeof(data->value.mcast_if.inet.ip) == length)); 1591 1592 break; 1592 1593 } 1593 1594 default: 1594 PR_NOT_REACHED("Unknown socket option");1595 1595 break; 1596 1596 } … … 1702 1702 } 1703 1703 default: 1704 PR_NOT_REACHED("Unknown socket option");1705 1704 break; 1706 1705 } … … 2216 2215 PRFileDesc *bottom = PR_GetIdentitiesLayer( 2217 2216 pds[index].fd, PR_NSPR_IO_LAYER); 2218 PR_ASSERT(NULL != bottom); /* what to do about that? */2217 Assert(NULL != bottom); /* what to do about that? */ 2219 2218 pds[index].out_flags = 0; /* pre-condition */ 2220 2219 if ((NULL != bottom) -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
r101968 r102000 49 49 50 50 #include <iprt/asm.h> 51 #include <iprt/assert.h> 51 52 52 53 #ifdef VBOX … … 72 73 int rv; 73 74 rv = _PT_PTHREAD_MUTEXATTR_INIT(&_pt_mattr); 74 PR_ASSERT(0 == rv);75 Assert(0 == rv); 75 76 76 77 #ifdef LINUX 77 78 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 78 79 rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP); 79 PR_ASSERT(0 == rv);80 Assert(0 == rv); 80 81 #endif 81 82 #endif 82 83 83 84 rv = _PT_PTHREAD_CONDATTR_INIT(&_pt_cvar_attr); 84 PR_ASSERT(0 == rv);85 Assert(0 == rv); 85 86 } 86 87 … … 109 110 { 110 111 rv = pthread_mutex_unlock(&lock->mutex); 111 PR_ASSERT(0 == rv);112 Assert(0 == rv); 112 113 } 113 114 … … 118 119 { 119 120 PRCondVar *cv = notified->cv[index].cv; 120 PR_ASSERT(NULL != cv);121 PR_ASSERT(0 != notified->cv[index].times);121 Assert(NULL != cv); 122 Assert(0 != notified->cv[index].times); 122 123 if (-1 == notified->cv[index].times) 123 124 { 124 125 rv = pthread_cond_broadcast(&cv->cv); 125 PR_ASSERT(0 == rv);126 Assert(0 == rv); 126 127 } 127 128 else … … 130 131 { 131 132 rv = pthread_cond_signal(&cv->cv); 132 PR_ASSERT(0 == rv);133 Assert(0 == rv); 133 134 } 134 135 } … … 162 163 { 163 164 rv = _PT_PTHREAD_MUTEX_INIT(lock->mutex, _pt_mattr); 164 PR_ASSERT(0 == rv);165 Assert(0 == rv); 165 166 } 166 167 #if defined(DEBUG) … … 173 174 { 174 175 PRIntn rv; 175 PR_ASSERT(NULL != lock);176 PR_ASSERT(PR_FALSE == lock->locked);177 PR_ASSERT(0 == lock->notified.length);178 PR_ASSERT(NULL == lock->notified.link);176 Assert(NULL != lock); 177 Assert(PR_FALSE == lock->locked); 178 Assert(0 == lock->notified.length); 179 Assert(NULL == lock->notified.link); 179 180 rv = pthread_mutex_destroy(&lock->mutex); 180 PR_ASSERT(0 == rv);181 Assert(0 == rv); 181 182 #if defined(DEBUG) 182 183 memset(lock, 0xaf, sizeof(PRLock)); … … 189 190 { 190 191 PRIntn rv; 191 PR_ASSERT(lock != NULL);192 Assert(lock != NULL); 192 193 rv = pthread_mutex_lock(&lock->mutex); 193 PR_ASSERT(0 == rv);194 PR_ASSERT(0 == lock->notified.length);195 PR_ASSERT(NULL == lock->notified.link);196 PR_ASSERT(PR_FALSE == lock->locked);194 Assert(0 == rv); 195 Assert(0 == lock->notified.length); 196 Assert(NULL == lock->notified.link); 197 Assert(PR_FALSE == lock->locked); 197 198 lock->locked = PR_TRUE; 198 199 lock->owner = pthread_self(); … … 206 207 PRIntn rv; 207 208 208 PR_ASSERT(lock != NULL);209 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(lock->mutex));210 PR_ASSERT(PR_TRUE == lock->locked);211 PR_ASSERT(pthread_equal(lock->owner, pthread_self()));209 Assert(lock != NULL); 210 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(lock->mutex)); 211 Assert(PR_TRUE == lock->locked); 212 Assert(pthread_equal(lock->owner, pthread_self())); 212 213 213 214 if (!lock->locked || !pthread_equal(lock->owner, pthread_self())) … … 218 219 { 219 220 rv = pthread_mutex_unlock(&lock->mutex); 220 PR_ASSERT(0 == rv);221 Assert(0 == rv); 221 222 } 222 223 else pt_PostNotifies(lock, PR_TRUE); … … 281 282 _PT_Notified *notified = &cvar->lock->notified; 282 283 283 PR_ASSERT(PR_TRUE == cvar->lock->locked);284 PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));285 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));284 Assert(PR_TRUE == cvar->lock->locked); 285 Assert(pthread_equal(cvar->lock->owner, pthread_self())); 286 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex)); 286 287 287 288 while (1) … … 314 315 315 316 finished: 316 PR_ASSERT(PR_TRUE == cvar->lock->locked);317 PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));317 Assert(PR_TRUE == cvar->lock->locked); 318 Assert(pthread_equal(cvar->lock->owner, pthread_self())); 318 319 } /* pt_PostNotifyToCvar */ 319 320 … … 321 322 { 322 323 PRCondVar *cv = PR_NEW(PRCondVar); 323 PR_ASSERT(lock != NULL);324 Assert(lock != NULL); 324 325 if (cv != NULL) 325 326 { 326 327 int rv = _PT_PTHREAD_COND_INIT(cv->cv, _pt_cvar_attr); 327 PR_ASSERT(0 == rv);328 Assert(0 == rv); 328 329 cv->lock = lock; 329 330 cv->notify_pending = 0; … … 339 340 if (0 > ASMAtomicDecU32(&cvar->notify_pending)) 340 341 { 341 PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv);342 PRIntn rv = pthread_cond_destroy(&cvar->cv); Assert(0 == rv); 342 343 #if defined(DEBUG) 343 344 memset(cvar, 0xaf, sizeof(PRCondVar)); … … 353 354 PRThread *thred = PR_CurrentThread(); 354 355 355 PR_ASSERT(cvar != NULL);356 Assert(cvar != NULL); 356 357 /* We'd better be locked */ 357 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));358 PR_ASSERT(PR_TRUE == cvar->lock->locked);358 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex)); 359 Assert(PR_TRUE == cvar->lock->locked); 359 360 /* and it better be by us */ 360 PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));361 Assert(pthread_equal(cvar->lock->owner, pthread_self())); 361 362 362 363 if (_PT_THREAD_INTERRUPTED(thred)) goto aborted; … … 389 390 390 391 /* We just got the lock back - this better be empty */ 391 PR_ASSERT(PR_FALSE == cvar->lock->locked);392 Assert(PR_FALSE == cvar->lock->locked); 392 393 cvar->lock->locked = PR_TRUE; 393 394 cvar->lock->owner = pthread_self(); 394 395 395 PR_ASSERT(0 == cvar->lock->notified.length);396 Assert(0 == cvar->lock->notified.length); 396 397 thred->waiting = NULL; /* and now we're not */ 397 398 if (_PT_THREAD_INTERRUPTED(thred)) goto aborted; … … 411 412 PR_IMPLEMENT(PRStatus) PR_NotifyCondVar(PRCondVar *cvar) 412 413 { 413 PR_ASSERT(cvar != NULL);414 Assert(cvar != NULL); 414 415 pt_PostNotifyToCvar(cvar, PR_FALSE); 415 416 return PR_SUCCESS; … … 418 419 PR_IMPLEMENT(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar) 419 420 { 420 PR_ASSERT(cvar != NULL);421 Assert(cvar != NULL); 421 422 pt_PostNotifyToCvar(cvar, PR_TRUE); 422 423 return PR_SUCCESS; … … 447 448 int rv; 448 449 rv = _PT_PTHREAD_MUTEX_INIT(mon->lock.mutex, _pt_mattr); 449 PR_ASSERT(0 == rv);450 Assert(0 == rv); 450 451 451 452 _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner); … … 453 454 mon->cvar = cvar; 454 455 rv = _PT_PTHREAD_COND_INIT(mon->cvar->cv, _pt_cvar_attr); 455 PR_ASSERT(0 == rv);456 Assert(0 == rv); 456 457 mon->entryCount = 0; 457 458 mon->cvar->lock = &mon->lock; … … 477 478 { 478 479 int rv; 479 PR_ASSERT(mon != NULL);480 Assert(mon != NULL); 480 481 PR_DestroyCondVar(mon->cvar); 481 rv = pthread_mutex_destroy(&mon->lock.mutex); PR_ASSERT(0 == rv);482 rv = pthread_mutex_destroy(&mon->lock.mutex); Assert(0 == rv); 482 483 #if defined(DEBUG) 483 484 memset(mon, 0xaf, sizeof(PRMonitor)); … … 502 503 pthread_t self = pthread_self(); 503 504 504 PR_ASSERT(mon != NULL);505 Assert(mon != NULL); 505 506 /* 506 507 * This is safe only if mon->owner (a pthread_t) can be … … 512 513 PR_Lock(&mon->lock); 513 514 /* and now I have the lock */ 514 PR_ASSERT(0 == mon->entryCount);515 PR_ASSERT(_PT_PTHREAD_THR_HANDLE_IS_INVALID(mon->owner));515 Assert(0 == mon->entryCount); 516 Assert(_PT_PTHREAD_THR_HANDLE_IS_INVALID(mon->owner)); 516 517 _PT_PTHREAD_COPY_THR_HANDLE(self, mon->owner); 517 518 } … … 523 524 pthread_t self = pthread_self(); 524 525 525 PR_ASSERT(mon != NULL);526 Assert(mon != NULL); 526 527 /* The lock better be that - locked */ 527 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex));528 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex)); 528 529 /* we'd better be the owner */ 529 PR_ASSERT(pthread_equal(mon->owner, self));530 Assert(pthread_equal(mon->owner, self)); 530 531 if (!pthread_equal(mon->owner, self)) 531 532 return PR_FAILURE; 532 533 533 534 /* if it's locked and we have it, then the entries should be > 0 */ 534 PR_ASSERT(mon->entryCount > 0);535 Assert(mon->entryCount > 0); 535 536 mon->entryCount -= 1; /* reduce by one */ 536 537 if (mon->entryCount == 0) … … 549 550 pthread_t saved_owner; 550 551 551 PR_ASSERT(mon != NULL);552 Assert(mon != NULL); 552 553 /* we'd better be locked */ 553 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex));554 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex)); 554 555 /* and the entries better be positive */ 555 PR_ASSERT(mon->entryCount > 0);556 Assert(mon->entryCount > 0); 556 557 /* and it better be by us */ 557 PR_ASSERT(pthread_equal(mon->owner, pthread_self()));558 Assert(pthread_equal(mon->owner, pthread_self())); 558 559 559 560 /* tuck these away 'till later */ … … 574 575 PR_IMPLEMENT(PRStatus) PR_Notify(PRMonitor *mon) 575 576 { 576 PR_ASSERT(NULL != mon);577 Assert(NULL != mon); 577 578 /* we'd better be locked */ 578 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex));579 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex)); 579 580 /* and the entries better be positive */ 580 PR_ASSERT(mon->entryCount > 0);581 Assert(mon->entryCount > 0); 581 582 /* and it better be by us */ 582 PR_ASSERT(pthread_equal(mon->owner, pthread_self()));583 Assert(pthread_equal(mon->owner, pthread_self())); 583 584 584 585 pt_PostNotifyToCvar(mon->cvar, PR_FALSE); … … 589 590 PR_IMPLEMENT(PRStatus) PR_NotifyAll(PRMonitor *mon) 590 591 { 591 PR_ASSERT(mon != NULL);592 Assert(mon != NULL); 592 593 /* we'd better be locked */ 593 PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex));594 Assert(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex)); 594 595 /* and the entries better be positive */ 595 PR_ASSERT(mon->entryCount > 0);596 Assert(mon->entryCount > 0); 596 597 /* and it better be by us */ 597 PR_ASSERT(pthread_equal(mon->owner, pthread_self()));598 Assert(pthread_equal(mon->owner, pthread_self())); 598 599 599 600 pt_PostNotifyToCvar(mon->cvar, PR_TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.