Changeset 3477 for trunk/src/kash/shinstance.c
- Timestamp:
- Sep 17, 2020, 11:52:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shinstance.c
r3476 r3477 32 32 #include <string.h> 33 33 #include <stdlib.h> 34 #include <assert.h>35 34 #ifdef _MSC_VER 36 35 # include <process.h> … … 174 173 { 175 174 #if K_OS == K_OS_WINDOWS 176 assert(ptmp->i == 0x42);175 kHlpAssert(ptmp->i == 0x42); 177 176 LeaveCriticalSection((CRITICAL_SECTION *)pmtx); 178 177 ptmp->i = 0x21; … … 190 189 void sh_init_globals(void) 191 190 { 192 assert(g_sh_mtx.au64[SHMTX_MAGIC_IDX] != SHMTX_MAGIC);191 kHlpAssert(g_sh_mtx.au64[SHMTX_MAGIC_IDX] != SHMTX_MAGIC); 193 192 shmtx_init(&g_sh_mtx); 194 193 #ifndef SH_FORKED_MODE … … 317 316 sh_free(psh, psh->threadarg); 318 317 psh->threadarg = NULL; 319 assert(!psh->subshellstatus);318 kHlpAssert(!psh->subshellstatus); 320 319 if (psh->subshellstatus) 321 320 { … … 910 909 else 911 910 { 912 assert(old.sa_handler == SIG_IGN);911 kHlpAssert(old.sa_handler == SIG_IGN); 913 912 shold.sh_handler = SH_SIG_IGN; 914 913 } … … 919 918 /* fake */ 920 919 #ifndef _MSC_VER 921 assert(0);920 kHlpAssert(0); 922 921 old.sa_handler = SIG_DFL; 923 922 old.sa_flags = 0; … … 945 944 for (cur = g_sh_head; cur; cur = cur->next) 946 945 { 947 assert(cur->sigactions[signo].sh_handler == SH_SIG_UNK);946 kHlpAssert(cur->sigactions[signo].sh_handler == SH_SIG_UNK); 948 947 cur->sigactions[signo] = shold; 949 948 } … … 988 987 else 989 988 { 990 assert(pfn != SH_SIG_ERR);989 kHlpAssert(pfn != SH_SIG_ERR); 991 990 pfn(pshDst, signo); 992 991 } … … 1125 1124 && signo != SIGTTOU 1126 1125 && signo != SIGCONT) 1127 assert(0);1126 kHlpAssert(0); 1128 1127 } 1129 1128 #else 1130 1129 if (sigaction(signo, &g_sig_state[signo].sa, NULL)) 1131 assert(0);1130 kHlpAssert(0); 1132 1131 #endif 1133 1132 … … 1417 1416 { 1418 1417 unsigned refs = sh_atomic_dec(&sts->refs); 1419 assert(refs > 1);1420 assert(refs < 16);1418 kHlpAssert(refs > 1); 1419 kHlpAssert(refs < 16); 1421 1420 return refs; 1422 1421 } … … 1428 1427 { 1429 1428 unsigned refs = sh_atomic_dec(&sts->refs); 1430 assert(refs < ~(unsigned)0/4);1429 kHlpAssert(refs < ~(unsigned)0/4); 1431 1430 if (refs == 0) 1432 1431 { … … 1463 1462 # if K_OS == K_OS_WINDOWS 1464 1463 BOOL rc = ResetEvent((HANDLE)sts->towaiton); 1465 assert(rc); K_NOREF(rc);1464 kHlpAssert(rc); K_NOREF(rc); 1466 1465 # endif 1467 1466 } … … 1477 1476 if (!sts->towaiton) 1478 1477 { 1479 assert(0);1478 kHlpAssert(0); 1480 1479 sh_free(psh, sts); 1481 1480 return NULL; … … 1508 1507 sts->status = W_EXITCODE(iExit, 0); 1509 1508 sts->done = K_TRUE; 1510 rc = SetEvent((HANDLE)sts->towaiton); assert(rc); K_NOREF(rc);1509 rc = SetEvent((HANDLE)sts->towaiton); kHlpAssert(rc); K_NOREF(rc); 1511 1510 1512 1511 hThread = (HANDLE)sts->hThread; 1513 1512 sts->hThread = 0; 1514 rc = CloseHandle(hThread); assert(rc);1513 rc = CloseHandle(hThread); kHlpAssert(rc); 1515 1514 1516 1515 shsubshellstatus_release(psh, sts); … … 1781 1780 { 1782 1781 rc = psh->children[i].subshellstatus->done; 1783 assert(rc);1782 kHlpAssert(rc); 1784 1783 if (rc) 1785 1784 { … … 1812 1811 { 1813 1812 rc = CloseHandle(psh->children[i].hChild); 1814 assert(rc);1813 kHlpAssert(rc); 1815 1814 } 1816 1815 … … 2115 2114 */ 2116 2115 dwErr = WaitForSingleObject(ProcInfo.hProcess, INFINITE); 2117 assert(dwErr == WAIT_OBJECT_0);2116 kHlpAssert(dwErr == WAIT_OBJECT_0); 2118 2117 2119 2118 if (GetExitCodeProcess(ProcInfo.hProcess, &dwExitCode)) … … 2129 2128 /* this shouldn't happen... */ 2130 2129 TRACE2((psh, "sh_execve: GetExitCodeProcess failed: %u\n", GetLastError())); 2131 assert(0);2130 kHlpAssert(0); 2132 2131 errno = EINVAL; 2133 2132 } … … 2226 2225 shpid pgid = psh->pgid; 2227 2226 #ifndef _MSC_VER 2228 assert(pgid == getpgrp());2227 kHlpAssert(pgid == getpgrp()); 2229 2228 #endif 2230 2229 … … 2244 2243 shpid pgid = psh->pgid; 2245 2244 #ifndef _MSC_VER 2246 assert(pgid == getpgrp());2245 kHlpAssert(pgid == getpgrp()); 2247 2246 #endif 2248 2247 } 2249 2248 else 2250 2249 { 2251 assert(0);2250 kHlpAssert(0); 2252 2251 errno = ESRCH; 2253 2252 pgid = -1;
Note:
See TracChangeset
for help on using the changeset viewer.