| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/dispose_cmd.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /* dispose_command.c -- dispose of a COMMAND structure. */ | - | ||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. | - | ||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | This file is part of GNU Bash, the Bourne Again SHell. | - | ||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | Bash is free software: you can redistribute it and/or modify | - | ||||||||||||||||||||||||
| 8 | it under the terms of the GNU General Public License as published by | - | ||||||||||||||||||||||||
| 9 | the Free Software Foundation, either version 3 of the License, or | - | ||||||||||||||||||||||||
| 10 | (at your option) any later version. | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | Bash is distributed in the hope that it will be useful, | - | ||||||||||||||||||||||||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | ||||||||||||||||||||||||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | ||||||||||||||||||||||||
| 15 | GNU General Public License for more details. | - | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | You should have received a copy of the GNU General Public License | - | ||||||||||||||||||||||||
| 18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. | - | ||||||||||||||||||||||||
| 19 | */ | - | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | #include "config.h" | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | #include "bashtypes.h" | - | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | #if defined (HAVE_UNISTD_H) | - | ||||||||||||||||||||||||
| 26 | # include <unistd.h> | - | ||||||||||||||||||||||||
| 27 | #endif | - | ||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||
| 29 | #include "bashansi.h" | - | ||||||||||||||||||||||||
| 30 | #include "shell.h" | - | ||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | extern sh_obj_cache_t wdcache, wlcache; | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | /* Dispose of the command structure passed. */ | - | ||||||||||||||||||||||||
| 35 | void | - | ||||||||||||||||||||||||
| 36 | dispose_command (command) | - | ||||||||||||||||||||||||
| 37 | COMMAND *command; | - | ||||||||||||||||||||||||
| 38 | { | - | ||||||||||||||||||||||||
| 39 | if (command == 0)
| 9705414-140150651 | ||||||||||||||||||||||||
| 40 | return; executed 9705414 times by 1 test: return;Executed by:
| 9705414 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | if (command->redirects)
| 3102-140147549 | ||||||||||||||||||||||||
| 43 | dispose_redirects (command->redirects); executed 3102 times by 1 test: dispose_redirects (command->redirects);Executed by:
| 3102 | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | switch (command->type) | - | ||||||||||||||||||||||||
| 46 | { | - | ||||||||||||||||||||||||
| 47 | case cm_for: executed 1616277 times by 1 test: case cm_for:Executed by:
| 1616277 | ||||||||||||||||||||||||
| 48 | #if defined (SELECT_COMMAND) | - | ||||||||||||||||||||||||
| 49 | case cm_select: executed 9 times by 1 test: case cm_select:Executed by:
| 9 | ||||||||||||||||||||||||
| 50 | #endif | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | register FOR_COM *c; | - | ||||||||||||||||||||||||
| 53 | #if defined (SELECT_COMMAND) | - | ||||||||||||||||||||||||
| 54 | if (command->type == cm_select)
| 9-1616277 | ||||||||||||||||||||||||
| 55 | c = (FOR_COM *)command->value.Select; executed 9 times by 1 test: c = (FOR_COM *)command->value.Select;Executed by:
| 9 | ||||||||||||||||||||||||
| 56 | else | - | ||||||||||||||||||||||||
| 57 | #endif | - | ||||||||||||||||||||||||
| 58 | c = command->value.For; executed 1616277 times by 1 test: c = command->value.For;Executed by:
| 1616277 | ||||||||||||||||||||||||
| 59 | dispose_word (c->name); | - | ||||||||||||||||||||||||
| 60 | dispose_words (c->map_list); | - | ||||||||||||||||||||||||
| 61 | dispose_command (c->action); | - | ||||||||||||||||||||||||
| 62 | free (c); | - | ||||||||||||||||||||||||
| 63 | break; executed 1616286 times by 1 test: break;Executed by:
| 1616286 | ||||||||||||||||||||||||
| 64 | } | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | #if defined (ARITH_FOR_COMMAND) | - | ||||||||||||||||||||||||
| 67 | case cm_arith_for: executed 4552 times by 1 test: case cm_arith_for:Executed by:
| 4552 | ||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||
| 69 | register ARITH_FOR_COM *c; | - | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | c = command->value.ArithFor; | - | ||||||||||||||||||||||||
| 72 | dispose_words (c->init); | - | ||||||||||||||||||||||||
| 73 | dispose_words (c->test); | - | ||||||||||||||||||||||||
| 74 | dispose_words (c->step); | - | ||||||||||||||||||||||||
| 75 | dispose_command (c->action); | - | ||||||||||||||||||||||||
| 76 | free (c); | - | ||||||||||||||||||||||||
| 77 | break; executed 4552 times by 1 test: break;Executed by:
| 4552 | ||||||||||||||||||||||||
| 78 | } | - | ||||||||||||||||||||||||
| 79 | #endif /* ARITH_FOR_COMMAND */ | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | case cm_group: executed 1655514 times by 1 test: case cm_group:Executed by:
| 1655514 | ||||||||||||||||||||||||
| 82 | { | - | ||||||||||||||||||||||||
| 83 | dispose_command (command->value.Group->command); | - | ||||||||||||||||||||||||
| 84 | free (command->value.Group); | - | ||||||||||||||||||||||||
| 85 | break; executed 1655514 times by 1 test: break;Executed by:
| 1655514 | ||||||||||||||||||||||||
| 86 | } | - | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | case cm_subshell: executed 6458 times by 1 test: case cm_subshell:Executed by:
| 6458 | ||||||||||||||||||||||||
| 89 | { | - | ||||||||||||||||||||||||
| 90 | dispose_command (command->value.Subshell->command); | - | ||||||||||||||||||||||||
| 91 | free (command->value.Subshell); | - | ||||||||||||||||||||||||
| 92 | break; executed 6458 times by 1 test: break;Executed by:
| 6458 | ||||||||||||||||||||||||
| 93 | } | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | case cm_coproc: executed 36 times by 1 test: case cm_coproc:Executed by:
| 36 | ||||||||||||||||||||||||
| 96 | { | - | ||||||||||||||||||||||||
| 97 | free (command->value.Coproc->name); | - | ||||||||||||||||||||||||
| 98 | dispose_command (command->value.Coproc->command); | - | ||||||||||||||||||||||||
| 99 | free (command->value.Coproc); | - | ||||||||||||||||||||||||
| 100 | break; executed 36 times by 1 test: break;Executed by:
| 36 | ||||||||||||||||||||||||
| 101 | } | - | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | case cm_case: executed 32312615 times by 1 test: case cm_case:Executed by:
| 32312615 | ||||||||||||||||||||||||
| 104 | { | - | ||||||||||||||||||||||||
| 105 | register CASE_COM *c; | - | ||||||||||||||||||||||||
| 106 | PATTERN_LIST *t, *p; | - | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | c = command->value.Case; | - | ||||||||||||||||||||||||
| 109 | dispose_word (c->word); | - | ||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||
| 111 | for (p = c->clauses; p; )
| 32312615-79167555 | ||||||||||||||||||||||||
| 112 | { | - | ||||||||||||||||||||||||
| 113 | dispose_words (p->patterns); | - | ||||||||||||||||||||||||
| 114 | dispose_command (p->action); | - | ||||||||||||||||||||||||
| 115 | t = p; | - | ||||||||||||||||||||||||
| 116 | p = p->next; | - | ||||||||||||||||||||||||
| 117 | free (t); | - | ||||||||||||||||||||||||
| 118 | } executed 79167555 times by 1 test: end of blockExecuted by:
| 79167555 | ||||||||||||||||||||||||
| 119 | free (c); | - | ||||||||||||||||||||||||
| 120 | break; executed 32312615 times by 1 test: break;Executed by:
| 32312615 | ||||||||||||||||||||||||
| 121 | } | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | case cm_until: executed 22 times by 1 test: case cm_until:Executed by:
| 22 | ||||||||||||||||||||||||
| 124 | case cm_while: executed 1618045 times by 1 test: case cm_while:Executed by:
| 1618045 | ||||||||||||||||||||||||
| 125 | { | - | ||||||||||||||||||||||||
| 126 | register WHILE_COM *c; | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | c = command->value.While; | - | ||||||||||||||||||||||||
| 129 | dispose_command (c->test); | - | ||||||||||||||||||||||||
| 130 | dispose_command (c->action); | - | ||||||||||||||||||||||||
| 131 | free (c); | - | ||||||||||||||||||||||||
| 132 | break; executed 1618067 times by 1 test: break;Executed by:
| 1618067 | ||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | case cm_if: executed 3383 times by 1 test: case cm_if:Executed by:
| 3383 | ||||||||||||||||||||||||
| 136 | { | - | ||||||||||||||||||||||||
| 137 | register IF_COM *c; | - | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | c = command->value.If; | - | ||||||||||||||||||||||||
| 140 | dispose_command (c->test); | - | ||||||||||||||||||||||||
| 141 | dispose_command (c->true_case); | - | ||||||||||||||||||||||||
| 142 | dispose_command (c->false_case); | - | ||||||||||||||||||||||||
| 143 | free (c); | - | ||||||||||||||||||||||||
| 144 | break; executed 3383 times by 1 test: break;Executed by:
| 3383 | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | case cm_simple: executed 55905077 times by 1 test: case cm_simple:Executed by:
| 55905077 | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | register SIMPLE_COM *c; | - | ||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | c = command->value.Simple; | - | ||||||||||||||||||||||||
| 152 | dispose_words (c->words); | - | ||||||||||||||||||||||||
| 153 | dispose_redirects (c->redirects); | - | ||||||||||||||||||||||||
| 154 | free (c); | - | ||||||||||||||||||||||||
| 155 | break; executed 55905077 times by 1 test: break;Executed by:
| 55905077 | ||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | case cm_connection: executed 30837621 times by 1 test: case cm_connection:Executed by:
| 30837621 | ||||||||||||||||||||||||
| 159 | { | - | ||||||||||||||||||||||||
| 160 | register CONNECTION *c; | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | c = command->value.Connection; | - | ||||||||||||||||||||||||
| 163 | dispose_command (c->first); | - | ||||||||||||||||||||||||
| 164 | dispose_command (c->second); | - | ||||||||||||||||||||||||
| 165 | free (c); | - | ||||||||||||||||||||||||
| 166 | break; executed 30837621 times by 1 test: break;Executed by:
| 30837621 | ||||||||||||||||||||||||
| 167 | } | - | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | #if defined (DPAREN_ARITHMETIC) | - | ||||||||||||||||||||||||
| 170 | case cm_arith: executed 16179229 times by 1 test: case cm_arith:Executed by:
| 16179229 | ||||||||||||||||||||||||
| 171 | { | - | ||||||||||||||||||||||||
| 172 | register ARITH_COM *c; | - | ||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | c = command->value.Arith; | - | ||||||||||||||||||||||||
| 175 | dispose_words (c->exp); | - | ||||||||||||||||||||||||
| 176 | free (c); | - | ||||||||||||||||||||||||
| 177 | break; executed 16179229 times by 1 test: break;Executed by:
| 16179229 | ||||||||||||||||||||||||
| 178 | } | - | ||||||||||||||||||||||||
| 179 | #endif /* DPAREN_ARITHMETIC */ | - | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | #if defined (COND_COMMAND) | - | ||||||||||||||||||||||||
| 182 | case cm_cond: executed 610 times by 1 test: case cm_cond:Executed by:
| 610 | ||||||||||||||||||||||||
| 183 | { | - | ||||||||||||||||||||||||
| 184 | register COND_COM *c; | - | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | c = command->value.Cond; | - | ||||||||||||||||||||||||
| 187 | dispose_cond_node (c); | - | ||||||||||||||||||||||||
| 188 | break; executed 610 times by 1 test: break;Executed by:
| 610 | ||||||||||||||||||||||||
| 189 | } | - | ||||||||||||||||||||||||
| 190 | #endif /* COND_COMMAND */ | - | ||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | case cm_function_def: executed 11203 times by 1 test: case cm_function_def:Executed by:
| 11203 | ||||||||||||||||||||||||
| 193 | { | - | ||||||||||||||||||||||||
| 194 | register FUNCTION_DEF *c; | - | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | c = command->value.Function_def; | - | ||||||||||||||||||||||||
| 197 | dispose_function_def (c); | - | ||||||||||||||||||||||||
| 198 | break; executed 11203 times by 1 test: break;Executed by:
| 11203 | ||||||||||||||||||||||||
| 199 | } | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 202 | command_error ("dispose_command", CMDERR_BADTYPE, command->type, 0); | - | ||||||||||||||||||||||||
| 203 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 204 | } | - | ||||||||||||||||||||||||
| 205 | free (command); | - | ||||||||||||||||||||||||
| 206 | } executed 140150651 times by 1 test: end of blockExecuted by:
| 140150651 | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | #if defined (COND_COMMAND) | - | ||||||||||||||||||||||||
| 209 | /* How to free a node in a conditional command. */ | - | ||||||||||||||||||||||||
| 210 | void | - | ||||||||||||||||||||||||
| 211 | dispose_cond_node (cond) | - | ||||||||||||||||||||||||
| 212 | COND_COM *cond; | - | ||||||||||||||||||||||||
| 213 | { | - | ||||||||||||||||||||||||
| 214 | if (cond)
| 0-2041 | ||||||||||||||||||||||||
| 215 | { | - | ||||||||||||||||||||||||
| 216 | if (cond->left)
| 831-1210 | ||||||||||||||||||||||||
| 217 | dispose_cond_node (cond->left); executed 831 times by 1 test: dispose_cond_node (cond->left);Executed by:
| 831 | ||||||||||||||||||||||||
| 218 | if (cond->right)
| 600-1441 | ||||||||||||||||||||||||
| 219 | dispose_cond_node (cond->right); executed 600 times by 1 test: dispose_cond_node (cond->right);Executed by:
| 600 | ||||||||||||||||||||||||
| 220 | if (cond->op)
| 115-1926 | ||||||||||||||||||||||||
| 221 | dispose_word (cond->op); executed 1926 times by 1 test: dispose_word (cond->op);Executed by:
| 1926 | ||||||||||||||||||||||||
| 222 | free (cond); | - | ||||||||||||||||||||||||
| 223 | } executed 2041 times by 1 test: end of blockExecuted by:
| 2041 | ||||||||||||||||||||||||
| 224 | } executed 2041 times by 1 test: end of blockExecuted by:
| 2041 | ||||||||||||||||||||||||
| 225 | #endif /* COND_COMMAND */ | - | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | void | - | ||||||||||||||||||||||||
| 228 | dispose_function_def_contents (c) | - | ||||||||||||||||||||||||
| 229 | FUNCTION_DEF *c; | - | ||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||
| 231 | dispose_word (c->name); | - | ||||||||||||||||||||||||
| 232 | dispose_command (c->command); | - | ||||||||||||||||||||||||
| 233 | FREE (c->source_file); executed 22357 times by 1 test: sh_xfree((c->source_file), "dispose_cmd.c", 233);Executed by:
| 0-22357 | ||||||||||||||||||||||||
| 234 | } executed 22357 times by 1 test: end of blockExecuted by:
| 22357 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | void | - | ||||||||||||||||||||||||
| 237 | dispose_function_def (c) | - | ||||||||||||||||||||||||
| 238 | FUNCTION_DEF *c; | - | ||||||||||||||||||||||||
| 239 | { | - | ||||||||||||||||||||||||
| 240 | dispose_function_def_contents (c); | - | ||||||||||||||||||||||||
| 241 | free (c); | - | ||||||||||||||||||||||||
| 242 | } executed 11203 times by 1 test: end of blockExecuted by:
| 11203 | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | /* How to free a WORD_DESC. */ | - | ||||||||||||||||||||||||
| 245 | void | - | ||||||||||||||||||||||||
| 246 | dispose_word (w) | - | ||||||||||||||||||||||||
| 247 | WORD_DESC *w; | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | FREE (w->word); executed 558863560 times by 1 test: sh_xfree((w->word), "dispose_cmd.c", 249);Executed by:
| 292-558863560 | ||||||||||||||||||||||||
| 250 | ocache_free (wdcache, WORD_DESC, w); never executed: mcn = 0;executed 521682494 times by 1 test: end of blockExecuted by:
executed 521682494 times by 1 test: break;Executed by:
executed 521682494 times by 1 test: end of blockExecuted by:
executed 521682494 times by 1 test: end of blockExecuted by:
executed 521682494 times by 1 test: end of blockExecuted by:
never executed: memset (((w)), (0xdf), (sizeof(WORD_DESC)));executed 521682494 times by 1 test: end of blockExecuted by:
executed 37181358 times by 1 test: sh_xfree((w), "dispose_cmd.c", 250);Executed by:
code before this statement executed 1043364988 times by 1 test: case 7:Executed by:
code before this statement executed 1043364988 times by 1 test: case 6:Executed by:
code before this statement executed 1043364988 times by 1 test: case 5:Executed by:
code before this statement executed 1043364988 times by 1 test: case 4:Executed by:
code before this statement executed 1043364988 times by 1 test: case 3:Executed by:
code before this statement executed 1043364988 times by 1 test: case 2:Executed by:
code before this statement executed 1043364988 times by 1 test: case 1:Executed by:
executed 521682494 times by 1 test: case 0:Executed by:
never executed: case 7:never executed: case 6:never executed: case 5:never executed: case 4:never executed: case 3:never executed: case 2:never executed: case 1: | 0-1043364988 | ||||||||||||||||||||||||
| 251 | } executed 558863852 times by 1 test: end of blockExecuted by:
| 558863852 | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | /* Free a WORD_DESC, but not the word contained within. */ | - | ||||||||||||||||||||||||
| 254 | void | - | ||||||||||||||||||||||||
| 255 | dispose_word_desc (w) | - | ||||||||||||||||||||||||
| 256 | WORD_DESC *w; | - | ||||||||||||||||||||||||
| 257 | { | - | ||||||||||||||||||||||||
| 258 | w->word = 0; | - | ||||||||||||||||||||||||
| 259 | ocache_free (wdcache, WORD_DESC, w); never executed: mcn = 0;executed 115524570 times by 1 test: end of blockExecuted by:
executed 115524570 times by 1 test: break;Executed by:
executed 115524570 times by 1 test: end of blockExecuted by:
executed 115524570 times by 1 test: end of blockExecuted by:
executed 115524570 times by 1 test: end of blockExecuted by:
never executed: memset (((w)), (0xdf), (sizeof(WORD_DESC)));executed 115524570 times by 1 test: end of blockExecuted by:
executed 1112 times by 1 test: sh_xfree((w), "dispose_cmd.c", 259);Executed by:
code before this statement executed 231049140 times by 1 test: case 7:Executed by:
code before this statement executed 231049140 times by 1 test: case 6:Executed by:
code before this statement executed 231049140 times by 1 test: case 5:Executed by:
code before this statement executed 231049140 times by 1 test: case 4:Executed by:
code before this statement executed 231049140 times by 1 test: case 3:Executed by:
code before this statement executed 231049140 times by 1 test: case 2:Executed by:
code before this statement executed 231049140 times by 1 test: case 1:Executed by:
executed 115524570 times by 1 test: case 0:Executed by:
never executed: case 7:never executed: case 6:never executed: case 5:never executed: case 4:never executed: case 3:never executed: case 2:never executed: case 1: | 0-231049140 | ||||||||||||||||||||||||
| 260 | } executed 115525682 times by 1 test: end of blockExecuted by:
| 115525682 | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | /* How to get rid of a linked list of words. A WORD_LIST. */ | - | ||||||||||||||||||||||||
| 263 | void | - | ||||||||||||||||||||||||
| 264 | dispose_words (list) | - | ||||||||||||||||||||||||
| 265 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 266 | { | - | ||||||||||||||||||||||||
| 267 | WORD_LIST *t; | - | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | while (list)
| 443858634-498401600 | ||||||||||||||||||||||||
| 270 | { | - | ||||||||||||||||||||||||
| 271 | t = list; | - | ||||||||||||||||||||||||
| 272 | list = list->next; | - | ||||||||||||||||||||||||
| 273 | dispose_word (t->word); | - | ||||||||||||||||||||||||
| 274 | #if 0 | - | ||||||||||||||||||||||||
| 275 | free (t); | - | ||||||||||||||||||||||||
| 276 | #else | - | ||||||||||||||||||||||||
| 277 | ocache_free (wlcache, WORD_LIST, t); never executed: mcn = 0;executed 495038916 times by 1 test: end of blockExecuted by:
executed 495038916 times by 1 test: break;Executed by:
executed 495038916 times by 1 test: end of blockExecuted by:
executed 495038916 times by 1 test: end of blockExecuted by:
executed 495038916 times by 1 test: end of blockExecuted by:
never executed: memset (((t)), (0xdf), (sizeof(WORD_LIST)));executed 495038916 times by 1 test: end of blockExecuted by:
executed 3362684 times by 1 test: sh_xfree((t), "dispose_cmd.c", 277);Executed by:
code before this statement executed 990077832 times by 1 test: case 7:Executed by:
code before this statement executed 990077832 times by 1 test: case 6:Executed by:
code before this statement executed 990077832 times by 1 test: case 5:Executed by:
code before this statement executed 990077832 times by 1 test: case 4:Executed by:
code before this statement executed 990077832 times by 1 test: case 3:Executed by:
code before this statement executed 990077832 times by 1 test: case 2:Executed by:
code before this statement executed 990077832 times by 1 test: case 1:Executed by:
executed 495038916 times by 1 test: case 0:Executed by:
never executed: case 7:never executed: case 6:never executed: case 5:never executed: case 4:never executed: case 3:never executed: case 2:never executed: case 1: | 0-990077832 | ||||||||||||||||||||||||
| 278 | #endif | - | ||||||||||||||||||||||||
| 279 | } executed 498401600 times by 1 test: end of blockExecuted by:
| 498401600 | ||||||||||||||||||||||||
| 280 | } executed 443858634 times by 1 test: end of blockExecuted by:
| 443858634 | ||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | #ifdef INCLUDE_UNUSED | - | ||||||||||||||||||||||||
| 283 | /* How to dispose of an array of pointers to char. This is identical to | - | ||||||||||||||||||||||||
| 284 | free_array in stringlib.c. */ | - | ||||||||||||||||||||||||
| 285 | void | - | ||||||||||||||||||||||||
| 286 | dispose_word_array (array) | - | ||||||||||||||||||||||||
| 287 | char **array; | - | ||||||||||||||||||||||||
| 288 | { | - | ||||||||||||||||||||||||
| 289 | register int count; | - | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | if (array == 0) | - | ||||||||||||||||||||||||
| 292 | return; | - | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | for (count = 0; array[count]; count++) | - | ||||||||||||||||||||||||
| 295 | free (array[count]); | - | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | free (array); | - | ||||||||||||||||||||||||
| 298 | } | - | ||||||||||||||||||||||||
| 299 | #endif | - | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | /* How to dispose of an list of redirections. A REDIRECT. */ | - | ||||||||||||||||||||||||
| 302 | void | - | ||||||||||||||||||||||||
| 303 | dispose_redirects (list) | - | ||||||||||||||||||||||||
| 304 | REDIRECT *list; | - | ||||||||||||||||||||||||
| 305 | { | - | ||||||||||||||||||||||||
| 306 | register REDIRECT *t; | - | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | while (list)
| 1504083-87256034 | ||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||
| 310 | t = list; | - | ||||||||||||||||||||||||
| 311 | list = list->next; | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | if (t->rflags & REDIR_VARASSIGN)
| 76-1504007 | ||||||||||||||||||||||||
| 314 | dispose_word (t->redirector.filename); executed 76 times by 1 test: dispose_word (t->redirector.filename);Executed by:
| 76 | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | switch (t->instruction) | - | ||||||||||||||||||||||||
| 317 | { | - | ||||||||||||||||||||||||
| 318 | case r_reading_until: executed 3062 times by 1 test: case r_reading_until:Executed by:
| 3062 | ||||||||||||||||||||||||
| 319 | case r_deblank_reading_until: executed 50 times by 1 test: case r_deblank_reading_until:Executed by:
| 50 | ||||||||||||||||||||||||
| 320 | free (t->here_doc_eof); | - | ||||||||||||||||||||||||
| 321 | /*FALLTHROUGH*/ | - | ||||||||||||||||||||||||
| 322 | case r_reading_string: code before this statement executed 3112 times by 1 test: case r_reading_string:Executed by:
executed 88 times by 1 test: case r_reading_string:Executed by:
| 88-3112 | ||||||||||||||||||||||||
| 323 | case r_output_direction: executed 27153 times by 1 test: case r_output_direction:Executed by:
| 27153 | ||||||||||||||||||||||||
| 324 | case r_input_direction: executed 2948 times by 1 test: case r_input_direction:Executed by:
| 2948 | ||||||||||||||||||||||||
| 325 | case r_inputa_direction: never executed: case r_inputa_direction: | 0 | ||||||||||||||||||||||||
| 326 | case r_appending_to: executed 41 times by 1 test: case r_appending_to:Executed by:
| 41 | ||||||||||||||||||||||||
| 327 | case r_err_and_out: executed 33 times by 1 test: case r_err_and_out:Executed by:
| 33 | ||||||||||||||||||||||||
| 328 | case r_append_err_and_out: executed 6 times by 1 test: case r_append_err_and_out:Executed by:
| 6 | ||||||||||||||||||||||||
| 329 | case r_input_output: executed 18 times by 1 test: case r_input_output:Executed by:
| 18 | ||||||||||||||||||||||||
| 330 | case r_output_force: executed 19 times by 1 test: case r_output_force:Executed by:
| 19 | ||||||||||||||||||||||||
| 331 | case r_duplicating_input_word: executed 17 times by 1 test: case r_duplicating_input_word:Executed by:
| 17 | ||||||||||||||||||||||||
| 332 | case r_duplicating_output_word: executed 112 times by 1 test: case r_duplicating_output_word:Executed by:
| 112 | ||||||||||||||||||||||||
| 333 | case r_move_input_word: executed 7 times by 1 test: case r_move_input_word:Executed by:
| 7 | ||||||||||||||||||||||||
| 334 | case r_move_output_word: executed 7 times by 1 test: case r_move_output_word:Executed by:
| 7 | ||||||||||||||||||||||||
| 335 | dispose_word (t->redirectee.filename); | - | ||||||||||||||||||||||||
| 336 | /* FALLTHROUGH */ | - | ||||||||||||||||||||||||
| 337 | default: code before this statement executed 33561 times by 1 test: default:Executed by:
executed 1504083 times by 1 test: default:Executed by:
| 33561-1504083 | ||||||||||||||||||||||||
| 338 | break; executed 1504083 times by 1 test: break;Executed by:
| 1504083 | ||||||||||||||||||||||||
| 339 | } | - | ||||||||||||||||||||||||
| 340 | free (t); | - | ||||||||||||||||||||||||
| 341 | } executed 1504083 times by 1 test: end of blockExecuted by:
| 1504083 | ||||||||||||||||||||||||
| 342 | } executed 87256034 times by 1 test: end of blockExecuted by:
| 87256034 | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |