dtc: Add support for binary includes.

David Gibson david at gibson.dropbear.id.au
Fri Jun 13 10:01:25 EST 2008


On Thu, Jun 12, 2008 at 11:43:22AM -0500, Scott Wood wrote:
> On Wed, Jun 11, 2008 at 11:58:39AM +1000, David Gibson wrote:
> > Scott's original patch does still have some implementation details I
> > didn't like.  So in the interests of saving time, I've addressed some
> > of those, added a testcase, and and now resubmitting my revised
> > version of Scott's patch.
> 
> Acked-by: Scott Wood <scottwood at freescale.com>
> 
> > -struct data data_copy_file(FILE *f, size_t len)
> > +struct data data_copy_file(FILE *f, size_t maxlen)
> >  {
> > -	struct data d;
> > +	struct data d = empty_data;
> > +
> > +	while (!feof(f) && (d.len < maxlen)) {
> > +		size_t chunksize, ret;
> > +
> > +		if (maxlen == -1)
> > +			chunksize = 4096;
> > +		else
> > +			chunksize = maxlen - d.len;
> > +
> > +		d = data_grow_for(d, chunksize);
> > +		ret = fread(d.val + d.len, 1, chunksize, f);
> > +
> > +		if (ferror(f))
> > +			die("Error reading file into data: %s", strerror(errno));
> 
> It'd be nice if we could keep the filename around for reporting here...

It would.  Well, I've been intending to clean up the input file
handling in several ways already, I'll see if that can be worked in.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc-dev mailing list