=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/parse.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/make/parse.c 1999/12/16 16:52:11 1.28 --- src/usr.bin/make/parse.c 1999/12/16 17:02:45 1.29 *************** *** 1,4 **** ! /* $OpenBSD: parse.c,v 1.28 1999/12/16 16:52:11 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: parse.c,v 1.29 1999/12/16 17:02:45 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* *************** *** 43,49 **** #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: parse.c,v 1.28 1999/12/16 16:52:11 espie Exp $"; #endif #endif /* not lint */ --- 43,49 ---- #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: parse.c,v 1.29 1999/12/16 17:02:45 espie Exp $"; #endif #endif /* not lint */ *************** *** 2106,2123 **** { char *line; int c, lastc; ! Buffer buf; ! buf = Buf_Init(MAKE_BSIZE); for (;;) { ! Buf_Reset(buf); lastc = '\0'; while (((c = ParseReadc()) != '\n' || lastc == '\\') && c != EOF) { if (c == '\n') { ! Buf_ReplaceLastChar(buf, ' '); lineno++; while ((c = ParseReadc()) == ' ' || c == '\t'); --- 2106,2123 ---- { char *line; int c, lastc; ! BUFFER buf; ! Buf_Init(&buf, MAKE_BSIZE); for (;;) { ! Buf_Reset(&buf); lastc = '\0'; while (((c = ParseReadc()) != '\n' || lastc == '\\') && c != EOF) { if (c == '\n') { ! Buf_ReplaceLastChar(&buf, ' '); lineno++; while ((c = ParseReadc()) == ' ' || c == '\t'); *************** *** 2126,2136 **** break; } ! Buf_AddChar(buf, c); lastc = c; } ! line = Buf_Retrieve(buf); lineno++; /* allow for non-newline terminated lines while skipping */ if (line[0] == '.') --- 2126,2136 ---- break; } ! Buf_AddChar(&buf, c); lastc = c; } ! line = Buf_Retrieve(&buf); lineno++; /* allow for non-newline terminated lines while skipping */ if (line[0] == '.') *************** *** 2138,2152 **** if (c == EOF) { Parse_Error(PARSE_FATAL, "Unclosed conditional/for loop"); ! Buf_Destroy(buf, TRUE); ! return((char *)NULL); } if (skip == 0) break; } - Buf_Destroy(buf, FALSE); return line; } --- 2138,2151 ---- if (c == EOF) { Parse_Error(PARSE_FATAL, "Unclosed conditional/for loop"); ! Buf_Destroy(&buf); ! return NULL; } if (skip == 0) break; } return line; } *************** *** 2171,2177 **** static char * ParseReadLine () { ! Buffer buf; /* Buffer for current line */ register int c; /* the current character */ register int lastc; /* The most-recent character */ Boolean semiNL; /* treat semi-colons as newlines */ --- 2170,2176 ---- static char * ParseReadLine () { ! BUFFER buf; /* Buffer for current line */ register int c; /* the current character */ register int lastc; /* The most-recent character */ Boolean semiNL; /* treat semi-colons as newlines */ *************** *** 2214,2220 **** if (c != EOF) { lastc = c; ! buf = Buf_Init(MAKE_BSIZE); while (((c = ParseReadc ()) != '\n' || (lastc == '\\')) && (c != EOF)) --- 2213,2219 ---- if (c != EOF) { lastc = c; ! Buf_Init(&buf, MAKE_BSIZE); while (((c = ParseReadc ()) != '\n' || (lastc == '\\')) && (c != EOF)) *************** *** 2328,2334 **** /* * Copy in the previous character and save this one in lastc. */ ! Buf_AddChar(buf, lastc); lastc = c; } --- 2327,2333 ---- /* * Copy in the previous character and save this one in lastc. */ ! Buf_AddChar(&buf, lastc); lastc = c; } *************** *** 2336,2344 **** lineno++; if (lastc != '\0') ! Buf_AddChar(buf, lastc); ! line = Buf_Retrieve(buf); ! Buf_Destroy(buf, FALSE); /* * Strip trailing blanks and tabs from the line. --- 2335,2342 ---- lineno++; if (lastc != '\0') ! Buf_AddChar(&buf, lastc); ! line = Buf_Retrieve(&buf); /* * Strip trailing blanks and tabs from the line.