Deleted Added
full compact
parse.c (249033) parse.c (251958)
1/* $NetBSD: parse.c,v 1.188 2013/03/22 16:07:59 sjg Exp $ */
2
3/*
4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 143 unchanged lines hidden (view full) ---

152
153////////////////////////////////////////////////////////////
154// types and constants
155
156/*
157 * Structure for a file being read ("included file")
158 */
159typedef struct IFile {
1/* $NetBSD: parse.c,v 1.188 2013/03/22 16:07:59 sjg Exp $ */
2
3/*
4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 143 unchanged lines hidden (view full) ---

152
153////////////////////////////////////////////////////////////
154// types and constants
155
156/*
157 * Structure for a file being read ("included file")
158 */
159typedef struct IFile {
160 const char *fname; /* name of file */
160 char *fname; /* name of file */
161 int lineno; /* current line number in file */
162 int first_lineno; /* line number of start of text */
163 int cond_depth; /* 'if' nesting when file opened */
164 char *P_str; /* point to base of string buffer */
165 char *P_ptr; /* point to next char of string buffer */
166 char *P_end; /* point to the end of string buffer */
167 char *(*nextbuf)(void *, size_t *); /* Function to get more data */
168 void *nextbuf_arg; /* Opaque arg for nextbuf() */

--- 2170 unchanged lines hidden (view full) ---

2339 curFile = bmake_malloc(sizeof *curFile);
2340
2341 /*
2342 * Once the previous state has been saved, we can get down to reading
2343 * the new file. We set up the name of the file to be the absolute
2344 * name of the include file so error messages refer to the right
2345 * place.
2346 */
161 int lineno; /* current line number in file */
162 int first_lineno; /* line number of start of text */
163 int cond_depth; /* 'if' nesting when file opened */
164 char *P_str; /* point to base of string buffer */
165 char *P_ptr; /* point to next char of string buffer */
166 char *P_end; /* point to the end of string buffer */
167 char *(*nextbuf)(void *, size_t *); /* Function to get more data */
168 void *nextbuf_arg; /* Opaque arg for nextbuf() */

--- 2170 unchanged lines hidden (view full) ---

2339 curFile = bmake_malloc(sizeof *curFile);
2340
2341 /*
2342 * Once the previous state has been saved, we can get down to reading
2343 * the new file. We set up the name of the file to be the absolute
2344 * name of the include file so error messages refer to the right
2345 * place.
2346 */
2347 curFile->fname = name;
2347 curFile->fname = bmake_strdup(name);
2348 curFile->lineno = line;
2349 curFile->first_lineno = line;
2350 curFile->nextbuf = nextbuf;
2351 curFile->nextbuf_arg = arg;
2352 curFile->lf = NULL;
2353
2354 assert(nextbuf != NULL);
2355
2356 /* Get first block of input data */
2357 buf = curFile->nextbuf(curFile->nextbuf_arg, &len);
2358 if (buf == NULL) {
2359 /* Was all a waste of time ... */
2348 curFile->lineno = line;
2349 curFile->first_lineno = line;
2350 curFile->nextbuf = nextbuf;
2351 curFile->nextbuf_arg = arg;
2352 curFile->lf = NULL;
2353
2354 assert(nextbuf != NULL);
2355
2356 /* Get first block of input data */
2357 buf = curFile->nextbuf(curFile->nextbuf_arg, &len);
2358 if (buf == NULL) {
2359 /* Was all a waste of time ... */
2360 if (curFile->fname)
2361 free(curFile->fname);
2360 free(curFile);
2361 return;
2362 }
2363 curFile->P_str = buf;
2364 curFile->P_ptr = buf;
2365 curFile->P_end = buf+len;
2366
2367 curFile->cond_depth = Cond_save_depth();

--- 773 unchanged lines hidden ---
2362 free(curFile);
2363 return;
2364 }
2365 curFile->P_str = buf;
2366 curFile->P_ptr = buf;
2367 curFile->P_end = buf+len;
2368
2369 curFile->cond_depth = Cond_save_depth();

--- 773 unchanged lines hidden ---