[U-Boot] [PATCH 2/8] Add setenv_uint() and setenv_addr()
Simon Glass
sjg at chromium.org
Tue Oct 25 23:35:02 CEST 2011
Hi Mike
On Sat, Oct 22, 2011 at 10:29 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Sat, Oct 22, 2011 at 00:51, Simon Glass <sjg at chromium.org> wrote:
>> +int setenv_ulong(const char *varname, ulong value)
>> +{
>> + char *str = simple_itoa(value);
>> +
>> + return setenv(varname, str);
>> +}
>
> could be a one liner, but works either way
OK, was trying to separate that out deliberately.
>
>> +int setenv_addr(const char *varname, const void *addr)
>> +{
>> + char str[17];
>
> char str[sizeof(addr) * 2 + 1];
Yes of course!
>
>> + sprintf(str, "%x", (uintptr_t)addr);
>
> i wonder if we should use %p and drop the cast
> -mike
>
Is %p supposed to print a 0x before it or not? I saw some discussion
about this. I vote for %p no, and %#p yes.
I will tidy these up for v3.
Regards,
Simon
More information about the U-Boot
mailing list