[PATCH 1/2] pmap: rid of a warning (total 0 bytes)
Alexander Shishkin
virtuoso at slind.org
Fri Oct 22 12:12:17 UTC 2010
On Fri, Oct 22, 2010 at 01:15:34 +0200, Denys Vlasenko wrote:
> On Thu, Oct 21, 2010 at 12:32 PM, Alexander Shishkin <virtuoso at slind.org> wrote:
> > Signed-off-by: Alexander Shishkin <virtuoso at slind.org>
> > ---
> > procps/pmap.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/procps/pmap.c b/procps/pmap.c
> > index cfa94ed..52cf229 100644
> > --- a/procps/pmap.c
> > +++ b/procps/pmap.c
> > @@ -44,7 +44,7 @@ enum {
> >
> > static void print_smaprec(struct smaprec *currec, void *data)
> > {
> > - unsigned opt = (unsigned)data;
> > + unsigned opt = *(unsigned *)data;
>
> This can be fixed without the need for additional dereference.
> Just use pointer-sized integer:
>
> unsigned opt = (uintptr_t)data
>
> > - ret = procps_read_smaps(pid, &total, print_smaprec, (void*)opt);
> > + ret = procps_read_smaps(pid, &total, print_smaprec, &opt);
>
> And here, use: (void*)(uintptr_t)opt.
> Does this work?
Yes, this actually shrinks the code size on arm (unike my version, which
increased it). Thanks!
Regards,
--
Alex
More information about the busybox
mailing list