Lines Matching refs:ptr

29 #define IS_ALIGNED(ptr, type) \  argument
30 ((((uintptr_t) ptr) & (__alloc_buffer_assert_align (__alignof (type)) - 1)) \
69 double *ptr = alloc_buffer_alloc_array (&buf, double, 0); in test_empty_array() local
70 TEST_VERIFY (IS_ALIGNED (ptr, double)); in test_empty_array()
71 TEST_VERIFY ((ptr == NULL) == expect_failure); in test_empty_array()
78 struct twelve *ptr = alloc_buffer_alloc_array (&buf, struct twelve, 0); in test_empty_array() local
79 TEST_VERIFY (IS_ALIGNED (ptr, struct twelve)); in test_empty_array()
80 TEST_VERIFY ((ptr == NULL) == expect_failure); in test_empty_array()
253 signed char *ptr = alloc_buffer_alloc (&buf, signed char); in test_size_1() local
254 TEST_VERIFY_EXIT (ptr != NULL); in test_size_1()
256 *ptr = 126; in test_size_1()
262 char *ptr = alloc_buffer_alloc_array (&buf, char, 1); in test_size_1() local
263 TEST_VERIFY_EXIT (ptr != NULL); in test_size_1()
265 *ptr = (char) 253; in test_size_1()
322 signed char *ptr = alloc_buffer_alloc (&buf, signed char); in test_size_2() local
323 TEST_VERIFY_EXIT (ptr != NULL); in test_size_2()
325 *ptr = 'A'; in test_size_2()
331 char *ptr = alloc_buffer_alloc_array (&buf, char, 1); in test_size_2() local
332 TEST_VERIFY_EXIT (ptr != NULL); in test_size_2()
334 *ptr = 'B'; in test_size_2()
340 unsigned short *ptr = alloc_buffer_alloc (&buf, unsigned short); in test_size_2() local
341 TEST_VERIFY_EXIT (ptr != NULL); in test_size_2()
342 TEST_VERIFY (IS_ALIGNED (ptr, unsigned short)); in test_size_2()
344 *ptr = htons (0x12f4); in test_size_2()
350 unsigned short *ptr = alloc_buffer_alloc_array (&buf, unsigned short, 1); in test_size_2() local
351 TEST_VERIFY_EXIT (ptr != NULL); in test_size_2()
352 TEST_VERIFY (IS_ALIGNED (ptr, unsigned short)); in test_size_2()
354 *ptr = htons (0x13f5); in test_size_2()
360 char *ptr = alloc_buffer_alloc_array (&buf, char, 2); in test_size_2() local
361 TEST_VERIFY_EXIT (ptr != NULL); in test_size_2()
363 memcpy (ptr, "12", 2); in test_size_2()
380 short *ptr = alloc_buffer_alloc_array (&buf, short, SIZE / sizeof (short)); in test_misaligned() local
381 TEST_VERIFY_EXIT (ptr != NULL); in test_misaligned()
382 TEST_VERIFY (IS_ALIGNED (ptr, short)); in test_misaligned()
385 ptr[i] = htons (0xff01 + i); in test_misaligned()
386 TEST_VERIFY (memcmp (ptr, in test_misaligned()
393 uint32_t *ptr = alloc_buffer_alloc_array in test_misaligned() local
395 TEST_VERIFY_EXIT (ptr != NULL); in test_misaligned()
396 TEST_VERIFY (IS_ALIGNED (ptr, uint32_t)); in test_misaligned()
399 ptr[i] = htonl (0xf1e2d301 + i); in test_misaligned()
400 TEST_VERIFY (memcmp (ptr, in test_misaligned()
407 struct twelve *ptr = alloc_buffer_alloc (&buf, struct twelve); in test_misaligned() local
408 TEST_VERIFY_EXIT (ptr != NULL); in test_misaligned()
409 TEST_VERIFY (IS_ALIGNED (ptr, struct twelve)); in test_misaligned()
411 ptr->buffer[0] = htonl (0x11223344); in test_misaligned()
412 ptr->buffer[1] = htonl (0x55667788); in test_misaligned()
413 ptr->buffer[2] = htonl (0x99aabbcc); in test_misaligned()
414 TEST_VERIFY (memcmp (ptr, in test_misaligned()
422 double *ptr = alloc_buffer_alloc_array (&buf, double, 2); in test_misaligned() local
423 TEST_VERIFY_EXIT (ptr != NULL); in test_misaligned()
424 TEST_VERIFY (IS_ALIGNED (ptr, double)); in test_misaligned()
426 ptr[0] = nums[0]; in test_misaligned()
427 ptr[1] = nums[1]; in test_misaligned()
428 TEST_VERIFY (memcmp (ptr, nums, sizeof (nums)) == 0); in test_misaligned()
640 void *ptr = (void *) ""; /* Cannot be freed. */ in do_test() local
641 struct alloc_buffer buf = alloc_buffer_allocate (1, &ptr); in do_test()
643 free (ptr); /* Should have been overwritten. */ in do_test()
647 void *ptr= (void *) ""; /* Cannot be freed. */ in do_test() local
648 struct alloc_buffer buf = alloc_buffer_allocate (2, &ptr); in do_test()
650 free (ptr); /* Should have been overwritten. */ in do_test()