=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/job.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/make/job.c 1998/07/13 02:11:37 1.11 --- src/usr.bin/make/job.c 1998/12/05 00:06:27 1.12 *************** *** 1,4 **** ! /* $OpenBSD: job.c,v 1.11 1998/07/13 02:11:37 millert Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: job.c,v 1.12 1998/12/05 00:06:27 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* *************** *** 43,49 **** #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: job.c,v 1.11 1998/07/13 02:11:37 millert Exp $"; #endif #endif /* not lint */ --- 43,49 ---- #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: job.c,v 1.12 1998/12/05 00:06:27 espie Exp $"; #endif #endif /* not lint */ *************** *** 75,80 **** --- 75,82 ---- * Hence, the makefile must have been parsed * before this function is called. * + * Job_End Cleanup any memory used. + * * Job_Full Return TRUE if the job table is filled. * * Job_Empty Return TRUE if the job table is completely *************** *** 84,90 **** * the line as a shell specification. Returns * FAILURE if the spec was incorrect. * ! * Job_End Perform any final processing which needs doing. * This includes the execution of any commands * which have been/were attached to the .END * target. It should only be called when the --- 86,92 ---- * the line as a shell specification. Returns * FAILURE if the spec was incorrect. * ! * Job_Finish Perform any final processing which needs doing. * This includes the execution of any commands * which have been/were attached to the .END * target. It should only be called when the *************** *** 215,221 **** * Job_ParseShell function */ static char *shellPath = NULL, /* full pathname of * executable image */ ! *shellName; /* last component of shell */ static int maxJobs; /* The most children we can run at once */ --- 217,224 ---- * Job_ParseShell function */ static char *shellPath = NULL, /* full pathname of * executable image */ ! *shellName = NULL, /* last component of shell */ ! *shellArgv = NULL; /* Custom shell args */ static int maxJobs; /* The most children we can run at once */ *************** *** 1111,1118 **** */ Make_HandleUse(DEFAULT, gn); Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn); ! if (p1) ! free(p1); } else if (Dir_MTime(gn) == 0) { /* * The node wasn't the target of an operator we have no .DEFAULT --- 1114,1120 ---- */ Make_HandleUse(DEFAULT, gn); Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn); ! efree(p1); } else if (Dir_MTime(gn) == 0) { /* * The node wasn't the target of an operator we have no .DEFAULT *************** *** 2681,2694 **** while (isspace(*line)) { line++; } - words = brk_string(line, &wordCount, TRUE); memset((Address)&newShell, 0, sizeof(newShell)); /* * Parse the specification by keyword */ ! for (path = NULL, argc = wordCount - 1, argv = words + 1; argc != 0; argc--, argv++) { if (strncmp(*argv, "path=", 5) == 0) { --- 2683,2699 ---- while (isspace(*line)) { line++; } + efree(shellArgv); + + words = brk_string(line, &wordCount, TRUE, &shellArgv); + memset((Address)&newShell, 0, sizeof(newShell)); /* * Parse the specification by keyword */ ! for (path = NULL, argc = wordCount - 1, argv = words; argc != 0; argc--, argv++) { if (strncmp(*argv, "path=", 5) == 0) { *************** *** 2718,2723 **** --- 2723,2729 ---- } else { Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"", *argv); + free(words); return(FAILURE); } fullSpec = TRUE; *************** *** 2937,2943 **** /* *----------------------------------------------------------------------- ! * Job_End -- * Do final processing such as the running of the commands * attached to the .END target. * --- 2943,2949 ---- /* *----------------------------------------------------------------------- ! * Job_Finish -- * Do final processing such as the running of the commands * attached to the .END target. * *************** *** 2950,2956 **** *----------------------------------------------------------------------- */ int ! Job_End() { if (postCommands != NILGNODE && !Lst_IsEmpty(postCommands->commands)) { if (errors) { --- 2956,2962 ---- *----------------------------------------------------------------------- */ int ! Job_Finish() { if (postCommands != NILGNODE && !Lst_IsEmpty(postCommands->commands)) { if (errors) { *************** *** 2970,2975 **** --- 2976,2999 ---- return(errors); } + /*- + *----------------------------------------------------------------------- + * Job_End -- + * Cleanup any memory used by the jobs module + * + * Results: + * None. + * + * Side Effects: + * Memory is freed + *----------------------------------------------------------------------- + */ + void + Job_End() + { + efree(shellArgv); + } + /*- *----------------------------------------------------------------------- * Job_Wait --