Lines Matching refs:p
28 void *p; in TEST_BEGIN() local
31 p = mallocx(42, 0); in TEST_BEGIN()
32 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
33 sz = sallocx(p, 0); in TEST_BEGIN()
35 tsz = xallocx(p, sz, 0, 0); in TEST_BEGIN()
38 dallocx(p, 0); in TEST_BEGIN()
44 void *p; in TEST_BEGIN() local
47 p = mallocx(42, 0); in TEST_BEGIN()
48 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
49 sz = sallocx(p, 0); in TEST_BEGIN()
51 tsz = xallocx(p, sz, sz-42, 0); in TEST_BEGIN()
54 dallocx(p, 0); in TEST_BEGIN()
60 void *p; in TEST_BEGIN() local
63 p = mallocx(42, 0); in TEST_BEGIN()
64 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
65 sz = sallocx(p, 0); in TEST_BEGIN()
67 tsz = xallocx(p, sz + 5, 0, 0); in TEST_BEGIN()
70 dallocx(p, 0); in TEST_BEGIN()
133 void *p; in TEST_BEGIN() local
139 p = mallocx(small0, 0); in TEST_BEGIN()
140 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
143 assert_zu_eq(xallocx(p, 1, 0, 0), small0, in TEST_BEGIN()
147 assert_zu_le(xallocx(p, largemax, 0, 0), largemax, in TEST_BEGIN()
151 assert_zu_le(xallocx(p, largemax+1, 0, 0), largemax, in TEST_BEGIN()
153 assert_zu_le(xallocx(p, SIZE_T_MAX, 0, 0), largemax, in TEST_BEGIN()
156 dallocx(p, 0); in TEST_BEGIN()
163 void *p; in TEST_BEGIN() local
169 p = mallocx(small0, 0); in TEST_BEGIN()
170 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
173 assert_zu_le(xallocx(p, largemax-1, 2, 0), largemax, in TEST_BEGIN()
175 assert_zu_le(xallocx(p, largemax, 1, 0), largemax, in TEST_BEGIN()
179 assert_zu_le(xallocx(p, largemax+1, 2, 0), largemax, in TEST_BEGIN()
181 assert_zu_le(xallocx(p, largemax+2, 3, 0), largemax, in TEST_BEGIN()
183 assert_zu_le(xallocx(p, SIZE_T_MAX-2, 2, 0), largemax, in TEST_BEGIN()
185 assert_zu_le(xallocx(p, SIZE_T_MAX-1, 1, 0), largemax, in TEST_BEGIN()
188 dallocx(p, 0); in TEST_BEGIN()
195 void *p; in TEST_BEGIN() local
202 p = mallocx(small0, 0); in TEST_BEGIN()
203 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
205 assert_zu_eq(xallocx(p, small1, 0, 0), small0, in TEST_BEGIN()
208 assert_zu_eq(xallocx(p, small1, 0, 0), small0, in TEST_BEGIN()
211 assert_zu_eq(xallocx(p, small0, small1 - small0, 0), small0, in TEST_BEGIN()
215 assert_zu_eq(xallocx(p, small0, largemax - small0 + 1, 0), small0, in TEST_BEGIN()
217 assert_zu_eq(xallocx(p, small0, SIZE_T_MAX - small0, 0), small0, in TEST_BEGIN()
220 dallocx(p, 0); in TEST_BEGIN()
228 void *p; in TEST_BEGIN() local
237 p = mallocx(large3, flags); in TEST_BEGIN()
238 assert_ptr_not_null(p, "Unexpected mallocx() error"); in TEST_BEGIN()
240 assert_zu_eq(xallocx(p, large3, 0, flags), large3, in TEST_BEGIN()
243 assert_zu_ge(xallocx(p, large1, 0, flags), large1, in TEST_BEGIN()
245 assert_zu_ge(xallocx(p, smallmax, 0, flags), large1, in TEST_BEGIN()
248 if (xallocx(p, large3, 0, flags) != large3) { in TEST_BEGIN()
249 p = rallocx(p, large3, flags); in TEST_BEGIN()
250 assert_ptr_not_null(p, "Unexpected rallocx() failure"); in TEST_BEGIN()
253 assert_zu_eq(xallocx(p, large1, large3 - large1, flags), large3, in TEST_BEGIN()
255 assert_zu_eq(xallocx(p, large2, large3 - large2, flags), large3, in TEST_BEGIN()
257 assert_zu_ge(xallocx(p, large1, large2 - large1, flags), large2, in TEST_BEGIN()
259 assert_zu_ge(xallocx(p, smallmax, large1 - smallmax, flags), large1, in TEST_BEGIN()
262 assert_zu_ge(xallocx(p, large1, 0, flags), large1, in TEST_BEGIN()
265 assert_zu_le(xallocx(p, large3, 0, flags), large3, in TEST_BEGIN()
267 assert_zu_le(xallocx(p, largemax+1, 0, flags), large3, in TEST_BEGIN()
270 assert_zu_ge(xallocx(p, large1, 0, flags), large1, in TEST_BEGIN()
273 assert_zu_le(xallocx(p, large1, SIZE_T_MAX - large1, flags), largemax, in TEST_BEGIN()
276 assert_zu_ge(xallocx(p, large1, 0, flags), large1, in TEST_BEGIN()
279 assert_zu_le(xallocx(p, large1, large3 - large1, flags), large3, in TEST_BEGIN()
282 if (xallocx(p, large3, 0, flags) != large3) { in TEST_BEGIN()
283 p = rallocx(p, large3, flags); in TEST_BEGIN()
284 assert_ptr_not_null(p, "Unexpected rallocx() failure"); in TEST_BEGIN()
287 assert_zu_le(xallocx(p, large3, largemax - large3 + 1, flags), largemax, in TEST_BEGIN()
290 dallocx(p, flags); in TEST_BEGIN()
295 print_filled_extents(const void *p, uint8_t c, size_t len) in print_filled_extents() argument
297 const uint8_t *pc = (const uint8_t *)p; in print_filled_extents()
301 malloc_printf(" p=%p, c=%#x, len=%zu:", p, c, len); in print_filled_extents()
315 validate_fill(const void *p, uint8_t c, size_t offset, size_t len) in validate_fill() argument
317 const uint8_t *pc = (const uint8_t *)p; in validate_fill()
327 print_filled_extents(p, c, offset + len); in validate_fill()
337 void *p; in test_zero() local
341 p = mallocx(sz, flags); in test_zero()
342 assert_ptr_not_null(p, "Unexpected mallocx() error"); in test_zero()
343 assert_false(validate_fill(p, 0x00, 0, sz), "Memory not filled: sz=%zu", in test_zero()
350 memset(p, FILL_BYTE, sz); in test_zero()
351 assert_false(validate_fill(p, FILL_BYTE, 0, sz), in test_zero()
356 if (xallocx(p, sz, 0, flags) != sz) { in test_zero()
357 p = rallocx(p, sz, flags); in test_zero()
358 assert_ptr_not_null(p, "Unexpected rallocx() failure"); in test_zero()
360 assert_false(validate_fill(p, FILL_BYTE, 0, sz), in test_zero()
365 if (xallocx(p, sz+1, 0, flags) != nsz) { in test_zero()
366 p = rallocx(p, sz+1, flags); in test_zero()
367 assert_ptr_not_null(p, "Unexpected rallocx() failure"); in test_zero()
369 assert_false(validate_fill(p, FILL_BYTE, 0, sz), in test_zero()
371 assert_false(validate_fill(p, 0x00, sz, nsz-sz), in test_zero()
373 memset((void *)((uintptr_t)p + sz), FILL_BYTE, nsz-sz); in test_zero()
374 assert_false(validate_fill(p, FILL_BYTE, 0, nsz), in test_zero()
378 dallocx(p, flags); in test_zero()