[U-Boot] [PATCH 01/11] fw_env.c: Increase max dev path to 32
Tom Rini
trini at ti.com
Mon Oct 7 14:06:41 CEST 2013
On Mon, Oct 07, 2013 at 07:47:13AM +0200, Wolfgang Denk wrote:
> Dear Tom,
>
> In message <20131006205527.GP15917 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131007/9df4ef1e/attachment.pgp>
More information about the U-Boot
mailing list