Changeset 2754 for trunk/src/kmk
- Timestamp:
- Jan 24, 2015, 12:00:41 AM (10 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/commands.c
r2753 r2754 633 633 634 634 635 #ifdef KMK635 #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS 636 636 /* This is for saving memory in func_commands. */ 637 637 void 638 638 free_chopped_commands (struct commands *cmds) 639 639 { 640 if (cmds && cmds->command_lines != 0) 640 if ( cmds 641 && cmds->command_lines != 0 642 && cmds->refs == 0) 641 643 { 642 644 unsigned idx = cmds->ncommand_lines; … … 645 647 free (cmds->command_lines); 646 648 free (cmds->lines_flags); 647 cmds->command_lines = NULL; 648 cmds->lines_flags = NULL; 649 } 650 } 651 652 653 #endif /* CONFIG_WITH_COMMANDS_FUNC */ 649 cmds->command_lines = 0; 650 cmds->lines_flags = 0; 651 cmds->ncommand_lines = 0; 652 } 653 } 654 655 656 #endif /* CONFIG_WITH_MEMORY_OPTIMIZATIONS */ 654 657 /* Execute the commands to remake FILE. If they are currently executing, 655 658 return or have already finished executing, just return. Otherwise, -
trunk/src/kmk/commands.h
r2753 r2754 57 57 void delete_child_targets (struct child *child); 58 58 void chop_commands (struct commands *cmds); 59 #ifdef KMK59 #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS 60 60 void free_chopped_commands (struct commands *cmd); 61 61 #endif -
trunk/src/kmk/job.c
r2592 r2754 1016 1016 child->file->cmds->refs--; 1017 1017 if ( !child->file->intermediate 1018 && !child->file->pat_variables 1019 && child->file->cmds->refs == 0) 1020 { 1021 struct commands *cmds = child->file->cmds; 1022 unsigned int i; 1023 1024 for (i = 0; i < cmds->ncommand_lines; ++i) 1025 { 1026 free (cmds->command_lines[i]); 1027 cmds->command_lines[i] = 0; 1028 } 1029 free (cmds->command_lines); 1030 cmds->command_lines = 0; 1031 free (cmds->lines_flags); 1032 cmds->lines_flags = 0; 1033 cmds->ncommand_lines = 0; 1034 } 1018 && !child->file->pat_variables) 1019 free_chopped_commands(child->file->cmds); 1035 1020 #endif /* CONFIG_WITH_MEMORY_OPTIMIZATIONS */ 1036 1021 -
trunk/src/kmk/remake.c
r2753 r2754 1330 1330 #endif 1331 1331 1332 #ifdef KMK1332 #ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS 1333 1333 /* We're done with this command, so free the memory held by the chopped 1334 1334 command lines. Saves heap for the compilers & linkers. */
Note:
See TracChangeset
for help on using the changeset viewer.