Changeset 3458 for trunk/src/kash/shinstance.c
- Timestamp:
- Sep 14, 2020, 11:46:32 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shinstance.c
r3451 r3458 44 44 #include "error.h" 45 45 #include "memalloc.h" 46 #include "nodes.h" 46 47 #include "redir.h" 47 48 #include "shell.h" … … 274 275 unsigned left, i; 275 276 277 INTOFF; 278 276 279 sh_int_unlink(psh); 277 shfile_uninit(&psh->fdtab );280 shfile_uninit(&psh->fdtab, psh->tracefd); 278 281 sh_free_string_vector(psh, &psh->shenviron); 279 282 … … 328 331 struct arglist exparg; /**< holds expanded arg list */ 329 332 char *expdir; /**< Used by expandmeta. */ 330 331 /* exec.h */ 332 const char *pathopt; /**< set by padvance */ 333 334 /* exec.c */ 335 struct tblentry *cmdtable[CMDTABLESIZE]; 336 int builtinloc/* = -1*/; /**< index in path of %builtin, or -1 */ 337 333 #endif 334 335 /* exec.h/exec.c */ 336 psh->pathopt = NULL; 337 for (i = 0; i < CMDTABLESIZE; i++) 338 { 339 struct tblentry *cur = psh->cmdtable[i]; 340 if (cur) 341 { 342 do 343 { 344 struct tblentry *next = cur->next; 345 if (cur->cmdtype == CMDFUNCTION) 346 { 347 freefunc(psh, cur->param.func); 348 cur->param.func = NULL; 349 } 350 sh_free(psh, cur); 351 cur = next; 352 } while (cur); 353 psh->cmdtable[i] = NULL; 354 } 355 } 356 357 #if 0 338 358 /* input.h */ 339 359 int plinno/* = 1 */;/**< input line number */ … … 382 402 int sstrnleft; 383 403 int herefd/* = -1 */; 384 385 /* memalloc.c */386 struct stack_block stackbase;387 struct stack_block *stackp/* = &stackbase*/;388 struct stackmark *markp;389 404 390 405 /* myhistedit.h */ … … 491 506 #endif 492 507 493 /** @todo finish this... */ 508 /* 509 * memalloc.c: Make sure we've gotten rid of all the stack memory. 510 */ 511 if (psh->stackp != &psh->stackbase && psh->stackp) 512 { 513 struct stack_block *stackp = psh->stackp; 514 do 515 { 516 psh->stackp = stackp->prev; 517 sh_free(psh, stackp); 518 } while ((stackp = psh->stackp) != &psh->stackbase && stackp); 519 } 520 #ifdef KASH_SEPARATE_PARSER_ALLOCATOR //bp msvcr100!_wassert 521 if (psh->pstack) 522 { 523 if (psh->pstacksize > 0) 524 pstackpop(psh, 0); 525 sh_free(psh, psh->pstack); 526 psh->pstack = NULL; 527 } 528 #endif 529 psh->markp = NULL; 530 531 532 /* 533 * Finally get rid of tracefd and then free the shell: 534 */ 535 shfile_uninit(&psh->fdtab, -1); 536 494 537 memset(psh, 0, sizeof(*psh)); 495 538 sh_free(NULL, psh); … … 673 716 { 674 717 /* 718 * Make sure we can use TRACE/TRACE2 for logging here. 719 */ 720 #ifdef DEBUG 721 /* show.c */ 722 psh->tracefd = inherit->tracefd; 723 /* options.c */ 724 debug(psh) = debug(inherit); 725 #endif 726 727 /* 675 728 * Do the rest of the inheriting. 676 729 */ … … 743 796 /* redir.c */ 744 797 subshellinitredir(psh, inherit); 745 746 /* show.c */747 psh->tracefd = inherit->tracefd;748 798 749 799 /* trap.h / trap.c */ /** @todo we don't carry pendingsigs to the subshell, right? */ … … 1663 1713 { 1664 1714 TRACE2((psh, "sh__exit: %u shells around, must wait...\n", g_num_shells)); 1665 shfile_uninit(&psh->fdtab );1715 shfile_uninit(&psh->fdtab, psh->tracefd); 1666 1716 sh_int_unlink(psh); 1667 1717 /** @todo */
Note:
See TracChangeset
for help on using the changeset viewer.