On Mon, Oct 07, 2013 at 07:47:13AM +0200, Wolfgang Denk wrote: > Dear Tom, > > In message <20131006205527.GP15917@bill-the-cat> you wrote: > > > > > Do we really need a static size here? Can we not auto-adjust to the > > > needed size, say by dynamically allocating the buffer? > > > > Doesn't look like it, without a big change to the parsing code. > > I don't think this requires a big change. Eventually all it takes is > changing the sscanf() call in get_config() to use a format "%ms" > instead of plain "%s"; form the sscanf() man page: > > ?? An optional 'm' character. This is used with string > conversions (%s, %c, %[), and relieves the caller of the > need to allocate a corresponding buffer to hold the input: > instead, scanf() allocates a buffer of sufficient size, and > assigns the address of this buffer to the corresponding > pointer argument, which should be a pointer to a char * > variable (this variable does not need to be initialized > before the call). The caller should subsequently free(3) > this buffer when it is no longer required. > > OK, the struct should then of course contain a const char pointer > instead of the buffer itself, but that's also a trivial change.
Well, that's what I get for looking at the code, and not checking man pages. Agreed, I'll re-work this part. -- Tom
signature.asc
Description: Digital signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot