Changeset 35 for trunk/src/kmk/parse.c
- Timestamp:
- Mar 18, 2003, 4:58:49 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/parse.c
r30 r35 252 252 static void ParseUnreadc __P((int)); 253 253 static void ParseHasCommands __P((ClientData)); 254 static void ParseDoInclude __P((char * ));254 static void ParseDoInclude __P((char *, char)); 255 255 static void ParseDoError __P((char *)); 256 256 #ifdef SYSVINCLUDE … … 540 540 * If we have noted the existence of a .MAIN, it means we need 541 541 * to add the sources of said target to the list of things 542 * to create. The string 'src' is likely to be free, so we542 * to create. The string 'src' is likely to be efree, so we 543 543 * must make a new copy of it. Note that this will only be 544 544 * invoked if the user didn't specify a target on the command … … 765 765 766 766 if (freeIt) { 767 free(result);767 efree(result); 768 768 } 769 769 cp += length-1; … … 1454 1454 1455 1455 Var_Set(line, cp, ctxt); 1456 free(cp);1456 efree(cp); 1457 1457 } else if (type == VAR_SHELL) { 1458 1458 Boolean freeCmd = FALSE; /* TRUE if the command needs to be freed, i.e. … … 1472 1472 res = Cmd_Exec(cp, &err); 1473 1473 Var_Set(line, res, ctxt); 1474 free(res);1474 efree(res); 1475 1475 1476 1476 if (err) … … 1478 1478 1479 1479 if (freeCmd) 1480 free(cp);1480 efree(cp); 1481 1481 } else { 1482 1482 /* … … 1605 1605 */ 1606 1606 static void 1607 ParseDoInclude (file )1607 ParseDoInclude (file, chPre) 1608 1608 char *file; /* file specification */ 1609 char chPre; /* Preprocessor char */ 1609 1610 { 1610 1611 char *fullname; /* full pathname of file */ … … 1621 1622 } 1622 1623 1624 #ifndef NMAKE 1623 1625 if ((*file != '"') && (*file != '<')) { 1624 1626 Parse_Error (PARSE_FATAL, 1625 " .include filename must be delimited by '\"' or '<'");1627 "%cinclude filename must be delimited by '\"' or '<'", chPre); 1626 1628 return; 1627 1629 } 1630 #endif 1628 1631 1629 1632 /* … … 1637 1640 } else { 1638 1641 isSystem = FALSE; 1642 #ifdef NMAKE 1643 if (*file == '"') 1644 endc = '"'; 1645 else 1646 { 1647 endc = '\0'; 1648 file--; 1649 } 1650 #else 1639 1651 endc = '"'; 1652 #endif 1640 1653 } 1641 1654 … … 1647 1660 } 1648 1661 1662 #ifdef NMAKE 1663 if (endc && *cp != endc) { 1664 #else 1649 1665 if (*cp != endc) { 1666 #endif 1650 1667 Parse_Error (PARSE_FATAL, 1651 1668 "Unclosed %cinclude filename. '%c' expected", 1652 '.', endc);1669 chPre, endc); 1653 1670 return; 1654 1671 } … … 1692 1709 fullname = Dir_FindFile(newName, dirSearchPath); 1693 1710 } 1694 free (newName);1711 efree (newName); 1695 1712 *prefEnd = '/'; 1696 1713 } else { 1697 1714 fullname = (char *)NULL; 1698 1715 } 1699 free (Fname);1716 efree (Fname); 1700 1717 } else { 1701 1718 fullname = (char *)NULL; … … 1725 1742 if (fullname == (char *) NULL) { 1726 1743 *cp = endc; 1727 Parse_Error (PARSE_FATAL, "Could not find %s", file);1744 Parse_Error (PARSE_FATAL, "Could not find '%s'", file); 1728 1745 return; 1729 1746 } 1730 1747 1731 free(file);1748 efree(file); 1732 1749 1733 1750 /* … … 1882 1899 fullname = Dir_FindFile(newName, dirSearchPath); 1883 1900 } 1884 free (newName);1901 efree (newName); 1885 1902 *prefEnd = '/'; 1886 1903 } else { … … 1977 1994 1978 1995 ifile = (IFile *) Lst_DeQueue (includes); 1979 free ((Address) fname);1996 efree ((Address) fname); 1980 1997 fname = ifile->fname; 1981 1998 lineno = ifile->lineno; … … 1983 2000 (void) fclose (curFILE); 1984 2001 if (curPTR) { 1985 free((Address) curPTR->str);1986 free((Address) curPTR);2002 efree((Address) curPTR->str); 2003 efree((Address) curPTR); 1987 2004 } 1988 2005 curFILE = ifile->F; 1989 2006 curPTR = ifile->p; 1990 free ((Address)ifile);2007 efree ((Address)ifile); 1991 2008 return (CONTINUE); 1992 2009 } … … 2083 2100 Buf_AddByte(buf, (Byte)'\0'); 2084 2101 line = (char *)Buf_GetAll(buf, &lineLength); 2102 #ifdef NMAKE 2103 } while (skip == 1 && line[0] != '.' && line[0] != '!'); 2104 #else 2085 2105 } while (skip == 1 && line[0] != '.'); 2106 #endif 2086 2107 2087 2108 Buf_Destroy(buf, FALSE); … … 2328 2349 */ 2329 2350 do { 2330 free (line);2351 efree (line); 2331 2352 line = ParseSkipLine(1); 2332 2353 } while (line && Cond_Eval(line) != COND_PARSE); … … 2335 2356 /*FALLTHRU*/ 2336 2357 case COND_PARSE: 2337 free ((Address) line);2358 efree ((Address) line); 2338 2359 line = ParseReadLine(); 2339 2360 break; … … 2341 2362 if (For_Eval(line)) { 2342 2363 int ok; 2343 free(line);2364 efree(line); 2344 2365 do { 2345 2366 /* … … 2353 2374 } 2354 2375 ok = For_Eval(line); 2355 free(line);2376 efree(line); 2356 2377 } 2357 2378 while (ok); … … 2430 2451 while ((line = ParseReadLine ()) != NULL) { 2431 2452 //debugkso: fprintf(stderr, "%s(%d): inLine=%d line=%s\n", fname, lineno, inLine, line); 2453 #ifdef NMAKE 2454 if (*line == '.' || *line == '!') { 2455 #else 2432 2456 if (*line == '.') { 2457 #endif 2433 2458 /* 2434 2459 * Lines that begin with the special character are either … … 2439 2464 } 2440 2465 if (strncmp (cp, "include", 7) == 0) { 2441 ParseDoInclude (cp + 7 );2466 ParseDoInclude (cp + 7, *line); 2442 2467 goto nextLine; 2443 2468 } else if (strncmp (cp, "error", 5) == 0) { … … 2553 2578 2554 2579 cp = Var_Subst (NULL, line, VAR_CMD, TRUE); 2555 free (line);2580 efree (line); 2556 2581 line = cp; 2557 2582 … … 2573 2598 nextLine: 2574 2599 2575 free (line);2600 efree (line); 2576 2601 } 2577 2602 /* … … 2614 2639 Parse_End() 2615 2640 { 2616 Lst_Destroy(targCmds, (void (*) __P((ClientData))) free);2641 Lst_Destroy(targCmds, (void (*) __P((ClientData))) efree); 2617 2642 if (targets) 2618 2643 Lst_Destroy(targets, NOFREE);
Note:
See TracChangeset
for help on using the changeset viewer.