[PATCH] Avoid pointer arithmetic on void* in test/integration/rallocx.c

Jason Evans jasone at canonware.com
Tue May 27 15:28:09 PDT 2014


On May 21, 2014, at 2:13 AM, Mike Hommey <mh+jemalloc at glandium.org> wrote:
> ---
> test/integration/rallocx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/test/integration/rallocx.c b/test/integration/rallocx.c
> index ee21aed..7acb211 100644
> --- a/test/integration/rallocx.c
> +++ b/test/integration/rallocx.c
> @@ -95,7 +95,7 @@ TEST_BEGIN(test_zero)
> 				    "Expected zeroed memory");
> 			}
> 			if (psz != qsz) {
> -				memset(q+psz, FILL_BYTE, qsz-psz);
> +				memset((char *)q+psz, FILL_BYTE, qsz-psz);
> 				psz = qsz;
> 			}
> 			p = q;
> @@ -159,8 +159,8 @@ TEST_BEGIN(test_lg_align_and_zero)
> 		} else {
> 			assert_false(validate_fill(q, 0, 0, MAX_VALIDATE),
> 			    "Expected zeroed memory");
> -			assert_false(validate_fill(q+sz-MAX_VALIDATE, 0, 0,
> -			    MAX_VALIDATE), "Expected zeroed memory");
> +			assert_false(validate_fill((char *)q+sz-MAX_VALIDATE,
> +                            0, 0, MAX_VALIDATE), "Expected zeroed memory");
> 		}
> 		p = q;
> 	}

Integrated, with minor modification:

	https://github.com/jemalloc/jemalloc/commit/3a730dfd5062ecd6fc46b68f28342e14b461f560

Thanks,
Jason


More information about the jemalloc-discuss mailing list