On Mon, 2013-08-26 at 15:29 -0700, Roland McGrath wrote: > Arithmetic on void * is a GNU extension and we use it freely in elfutils > code. Don't insert unnecessary casts to char *.
I admit I wasn't aware of that extension http://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html Treating the size of void as 1 does seem to be the only logical (and convenient) choice. Now that I have seen it I wonder why the standard doesn't just say that. Anyway, unnecessary cast removed: commit 4f017daab51f4281e9d859b2491efe83fd199692 Author: Mark Wielaard <[email protected]> Date: Tue Aug 27 11:39:52 2013 +0200 gelf_getauxv: Remove unnecessary casts to char *. Signed-off-by: Mark Wielaard <[email protected]> diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 46d4731..c867010 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2013-08-27 Mark Wielaard <[email protected]> + + * gelf_getauxv.c (gelf_getauxv): Remove unnecessary casts to char *. + 2013-08-25 Kurt Roeckx <[email protected]> * gelf_getauxv.c (gelf_getauxv): Use memcpy instead of pointer diff --git a/libelf/gelf_getauxv.c b/libelf/gelf_getauxv.c index 2a5b6f0..6b91030 100644 --- a/libelf/gelf_getauxv.c +++ b/libelf/gelf_getauxv.c @@ -97,7 +97,7 @@ gelf_getauxv (data, ndx, dst) goto out; } - memcpy(dst, (char *) data_scn->d.d_buf + ndx * sizeof (GElf_auxv_t), + memcpy(dst, data_scn->d.d_buf + ndx * sizeof (GElf_auxv_t), sizeof (GElf_auxv_t)); } _______________________________________________ elfutils-devel mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/elfutils-devel
