[PATCH 2/3] Look for include files in the directory of the including file.

Scott Wood scottwood at freescale.com
Mon Jan 7 09:52:52 EST 2008


On Fri, Jan 04, 2008 at 03:27:39PM +1100, David Gibson wrote:
> > +	newfile = dtc_open_file(filename, searchptr);
> > +	if (!newfile) {
> > +		yyerrorf("Couldn't open \"%s\": %s",
> > +		         filename, strerror(errno));
> > +		exit(1);
> 
> Use die() here, that's what it's for.

die() doesn't print file and line information.

> > +	while (search) {
> > +		if (dtc_open_one(file, search->dir, fname))
> > +			return file;
> 
> Don't we need a different case here somewhere for if someone specifies
> an include file as an absolute path?  Have I missed something?

Yeah, I forgot about that, and sent another patch to fix it when I
noticed (jdl had already pulled, so I didn't send an amended patch).

> [snip]
> > +struct search_path {
> > +	const char *dir; /* NULL for current directory */
> > +	struct search_path *prev, *next;
> > +};
> 
> I wouldn't suggest a doubly linked list here.  Or at least not without
> converting our many existing singly linked lists at the same time.

The doubly-linked list is intended to make it easier to construct search
path lists one-at-a-time from arguments in the proper order, without
needing to reverse the list at the end.

-Scott



More information about the Linuxppc-dev mailing list