Home
last modified time | relevance | path

Searched refs:ptr (Results 1 – 25 of 69) sorted by relevance

123

/bionic/libc/bionic/
Dmalloc_tagged_pointers.h72 static inline void* TagPointer(void* ptr) { in TagPointer() argument
74 return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) | FixedPointerTag()); in TagPointer()
76 async_safe_fatal("Attempting to tag a pointer (%p) on non-aarch64.", ptr); in TagPointer()
83 static inline void* UntagPointer(const volatile void* ptr) { in UntagPointer() argument
84 return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) & ADDRESS_MASK); in UntagPointer()
89 static inline void* MaybeUntagAndCheckPointer(const volatile void* ptr) { in MaybeUntagAndCheckPointer() argument
90 if (__predict_false(ptr == nullptr)) { in MaybeUntagAndCheckPointer()
94 uintptr_t ptr_int = reinterpret_cast<uintptr_t>(ptr); in MaybeUntagAndCheckPointer()
105 ptr); in MaybeUntagAndCheckPointer()
112 static inline void* MaybeTagPointer(void* ptr) { in MaybeTagPointer() argument
[all …]
Dbionic_allocator.cpp164 void BionicSmallObjectAllocator::free(void* ptr) { in free() argument
167 PAGE_START(reinterpret_cast<uintptr_t>(ptr))); in free()
169 if (reinterpret_cast<uintptr_t>(ptr) % block_size_ != 0) { in free()
170 async_safe_fatal("invalid pointer: %p (block_size=%zd)", ptr, block_size_); in free()
173 memset(ptr, 0, block_size_); in free()
175 reinterpret_cast<small_object_block_record*>(ptr); in free()
329 inline page_info* BionicAllocator::get_page_info_unchecked(void* ptr) { in get_page_info_unchecked() argument
330 uintptr_t header_page = PAGE_START(reinterpret_cast<size_t>(ptr) - kPageInfoSize); in get_page_info_unchecked()
334 inline page_info* BionicAllocator::get_page_info(void* ptr) { in get_page_info() argument
335 page_info* info = get_page_info_unchecked(ptr); in get_page_info()
[all …]
Dnew.cpp42 void operator delete(void* ptr) throw() { in operator delete() argument
43 free(ptr); in operator delete()
46 void operator delete[](void* ptr) throw() { in operator delete[]() argument
47 free(ptr); in operator delete[]()
58 void operator delete(void* ptr, const std::nothrow_t&) throw() { in operator delete() argument
59 free(ptr); in operator delete()
62 void operator delete[](void* ptr, const std::nothrow_t&) throw() { in operator delete[]() argument
63 free(ptr); in operator delete[]()
D__cmsg_nxthdr.cpp32 cmsghdr* ptr; in __cmsg_nxthdr() local
33 ptr = reinterpret_cast<cmsghdr*>(reinterpret_cast<char*>(cmsg) + CMSG_ALIGN(cmsg->cmsg_len)); in __cmsg_nxthdr()
34 size_t len = reinterpret_cast<char*>(ptr+1) - reinterpret_cast<char*>(msg->msg_control); in __cmsg_nxthdr()
38 return ptr; in __cmsg_nxthdr()
Dnet_if.cpp146 struct if_nameindex* ptr = array; in if_freenameindex() local
147 while (ptr->if_index != 0 || ptr->if_name != nullptr) { in if_freenameindex()
148 free(ptr->if_name); in if_freenameindex()
149 ++ptr; in if_freenameindex()
/bionic/libc/malloc_hooks/tests/
Dmalloc_hooks_tests.cpp115 static void* test_realloc_hook(void* ptr, size_t, const void*);
163 void* MallocHooksTest::test_realloc_hook(void* ptr, size_t size, const void* arg) { in test_realloc_hook() argument
166 return orig_realloc_hook_(ptr, size, arg); in test_realloc_hook()
175 void MallocHooksTest::test_free_hook(void* ptr, const void* arg) { in test_free_hook() argument
178 return orig_free_hook_(ptr, arg); in test_free_hook()
193 void* ptr = malloc(1024); in TEST_F() local
194 EXPECT_LE(1024U, malloc_usable_size(ptr)); in TEST_F()
195 free(ptr); in TEST_F()
231 void* ptr = malloc(1024); in TEST_F() local
232 ASSERT_TRUE(ptr != nullptr); in TEST_F()
[all …]
/bionic/tests/
Dmalloc_test.cpp76 void *ptr = malloc(100); in TEST() local
77 ASSERT_TRUE(ptr != nullptr); in TEST()
78 ASSERT_LE(100U, malloc_usable_size(ptr)); in TEST()
79 free(ptr); in TEST()
92 char *ptr = (char *)calloc(1, alloc_len); in TEST() local
93 ASSERT_TRUE(ptr != nullptr); in TEST()
94 ASSERT_LE(alloc_len, malloc_usable_size(ptr)); in TEST()
96 ASSERT_EQ(0, ptr[i]); in TEST()
98 free(ptr); in TEST()
108 char *ptr = reinterpret_cast<char*>(calloc(1, alloc_len)); in TEST() local
[all …]
Dbionic_allocator_test.cpp66 void* ptr = allocator.alloc(0); in TEST() local
67 ASSERT_TRUE(ptr != nullptr); in TEST()
68 allocator.free(ptr); in TEST()
217 void* ptr; in TEST() local
220 ptr = allocator.memalign(0x100, 0x100); in TEST()
221 ASSERT_TRUE(ptr != nullptr); in TEST()
222 ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % 0x100); in TEST()
223 allocator.free(ptr); in TEST()
226 ptr = allocator.alloc(0x200); in TEST()
227 ASSERT_TRUE(ptr != nullptr); in TEST()
[all …]
Dmalloc_iterate_test.cpp41 void* ptr; member
55 void* ptr = malloc(size); in AllocPtr() local
56 ASSERT_TRUE(ptr != nullptr); in AllocPtr()
57 alloc->ptr = ptr; in AllocPtr()
58 alloc->size = malloc_usable_size(ptr); in AllocPtr()
65 free(test_data->allocs[i].ptr); in FreePtrs()
81 uintptr_t ptr = reinterpret_cast<uintptr_t>(test_data->allocs[i].ptr); in SavePointers() local
82 if (ptr >= base && ptr < end) { in SavePointers()
85 uintptr_t max_size = end - ptr; in SavePointers()
134 void* ptr = malloc(size); in AllocateSizes() local
[all …]
Dstring_test.cpp222 Character *ptr, *ptr1, *ptr2; member in StringTestState
250 ptr = ptr1 = ptr2 = nullptr; in ResetPointers()
252 ptr = glob_ptr + alignments[align1_index_]; in ResetPointers()
271 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN); in TEST()
277 strcpy(state.ptr + state.MAX_LEN - 1, state.ptr1); in TEST()
280 EXPECT_TRUE(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN) == 0); in TEST()
527 memcpy(state.ptr, state.ptr1, state.MAX_LEN); in TEST()
532 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN); in TEST()
533 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1); in TEST()
534 state.ptr[2 * state.MAX_LEN - 1] = '\0'; in TEST()
[all …]
/bionic/libc/arch-arm/bionic/
Datomics_arm.c61 __atomic_cmpxchg(int old, int _new, volatile int *ptr) in __atomic_cmpxchg() argument
64 return __sync_val_compare_and_swap(ptr, old, _new) != old; in __atomic_cmpxchg()
68 __atomic_swap(int _new, volatile int *ptr) in __atomic_swap() argument
72 prev = *ptr; in __atomic_swap()
73 } while (__sync_val_compare_and_swap(ptr, prev, _new) != prev); in __atomic_swap()
78 __atomic_dec(volatile int *ptr) in __atomic_dec() argument
80 return __sync_fetch_and_sub (ptr, 1); in __atomic_dec()
84 __atomic_inc(volatile int *ptr) in __atomic_inc() argument
86 return __sync_fetch_and_add (ptr, 1); in __atomic_inc()
/bionic/libc/malloc_debug/tests/
Dmalloc_debug_system_tests.cpp95 pthread_key_create(&jmp_data_key_, [](void* ptr) { free(ptr); }); in LogReader() argument
455 void* ptr = malloc(128); in TEST() local
456 free(ptr); in TEST()
475 void* ptr = aligned_alloc(64, 1152); in AlignedAlloc() local
476 ASSERT_TRUE(ptr != nullptr); in AlignedAlloc()
477 memset(ptr, 0, 1152); in AlignedAlloc()
490 void* ptr = calloc(1, 1123); in Calloc() local
491 ASSERT_TRUE(ptr != nullptr); in Calloc()
492 memset(ptr, 1, 1123); in Calloc()
505 void* ptr = malloc(1123); in Malloc() local
[all …]
/bionic/libc/dns/include/
Dhostent.h67 #define HENT_ARRAY(dst, anum, ptr, len) \ argument
72 dst = (void *)ptr; \
73 ptr += _len; \
77 #define HENT_COPY(dst, src, slen, ptr, len) \ argument
81 memcpy(ptr, src, (size_t)slen); \
82 dst = ptr; \
83 ptr += slen; \
87 #define HENT_SCOPY(dst, src, ptr, len) \ argument
90 HENT_COPY(dst, src, _len, ptr, len); \
/bionic/libc/upstream-openbsd/lib/libc/stdlib/
Drecallocarray.c31 recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) in recallocarray() argument
36 if (ptr == NULL) in recallocarray()
61 memset((char *)ptr + newsize, 0, d); in recallocarray()
62 return ptr; in recallocarray()
71 memcpy(newptr, ptr, oldsize); in recallocarray()
74 memcpy(newptr, ptr, newsize); in recallocarray()
76 explicit_bzero(ptr, oldsize); in recallocarray()
77 free(ptr); in recallocarray()
/bionic/libc/upstream-netbsd/lib/libc/stdlib/
Dreallocarr.c57 reallocarr(void *ptr, size_t number, size_t size) in __weak_alias()
64 memcpy(&optr, ptr, sizeof(ptr)); in __weak_alias()
68 memcpy(ptr, &nptr, sizeof(ptr)); in __weak_alias()
90 memcpy(ptr, &nptr, sizeof(ptr)); in __weak_alias()
/bionic/benchmarks/
Dmalloc_benchmark.cpp50 void* ptr = malloc(size); in RunMalloptPurge() local
51 if (ptr == nullptr) { in RunMalloptPurge()
54 MakeAllocationResident(ptr, size, pagesize); in RunMalloptPurge()
55 ptrs.push_back(ptr); in RunMalloptPurge()
60 for (auto ptr : ptrs) { in RunMalloptPurge() local
61 free(ptr); in RunMalloptPurge()
Dutil.cpp36 uintptr_t ptr = reinterpret_cast<uintptr_t>(orig_ptr); in GetAlignedMemory() local
41 ptr += alignment - (ptr & (alignment - 1)); in GetAlignedMemory()
42 ptr |= alignment | or_mask; in GetAlignedMemory()
45 return reinterpret_cast<char*>(ptr); in GetAlignedMemory()
Dstdlib_benchmark.cpp32 void* ptr; in MallocFree() local
33 benchmark::DoNotOptimize(ptr = malloc(nbytes)); in MallocFree()
34 MakeAllocationResident(ptr, nbytes, pagesize); in MallocFree()
35 free(ptr); in MallocFree()
67 void* ptr; in CallocFree() local
68 benchmark::DoNotOptimize(ptr = calloc(1, nbytes)); in CallocFree()
69 MakeAllocationResident(ptr, nbytes, pagesize); in CallocFree()
70 free(ptr); in CallocFree()
/bionic/libc/dns/net/
Dsethostent.c142 char *buf, *ptr; in _hf_gethtbyname2() local
158 if ((ptr = buf = malloc(len = info->buflen)) == NULL) { in _hf_gethtbyname2()
193 HENT_SCOPY(hent.h_name, hp->h_name, ptr, len); in _hf_gethtbyname2()
198 ptr, len); in _hf_gethtbyname2()
200 ptr = (void *)ALIGN(ptr); in _hf_gethtbyname2()
201 if ((size_t)(ptr - buf) >= info->buflen) in _hf_gethtbyname2()
207 HENT_COPY(addr_ptrs[num], hp->h_addr_list[0], hp->h_length, ptr, in _hf_gethtbyname2()
220 ptr = info->buf; in _hf_gethtbyname2()
226 HENT_ARRAY(hp->h_aliases, anum, ptr, len); in _hf_gethtbyname2()
227 HENT_ARRAY(hp->h_addr_list, num, ptr, len); in _hf_gethtbyname2()
[all …]
Dgethnamaddr.c209 #define BOUNDS_CHECK(ptr, count) \ argument
211 if (eom - (ptr) < (count)) \
587 char *ptr = hbuf; in android_read_hostent() local
590 if (ptr + size > hbuf_end) { in android_read_hostent()
593 if (fread(ptr, 1, size, proxy) != size) return NULL; in android_read_hostent()
594 hp->h_name = ptr; in android_read_hostent()
595 ptr += size; in android_read_hostent()
608 if (ptr + size > hbuf_end) { in android_read_hostent()
611 if (fread(ptr, 1, size, proxy) != size) return NULL; in android_read_hostent()
613 *aliases++ = ptr; in android_read_hostent()
[all …]
/bionic/libc/private/
Dbionic_allocator.h86 void free(void* ptr);
111 void* realloc(void* ptr, size_t size);
112 void free(void* ptr);
116 size_t get_chunk_size(void* ptr);
121 inline page_info* get_page_info_unchecked(void* ptr);
122 inline page_info* get_page_info(void* ptr);
/bionic/libc/dns/nameser/
Dns_parse.c82 ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) { in ns_skiprr() argument
83 const u_char *optr = ptr; in ns_skiprr()
88 b = dn_skipname(ptr, eom); in ns_skiprr()
91 ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/; in ns_skiprr()
93 if (ptr + NS_INT32SZ + NS_INT16SZ > eom) in ns_skiprr()
95 ptr += NS_INT32SZ/*TTL*/; in ns_skiprr()
96 NS_GET16(rdlength, ptr); in ns_skiprr()
97 ptr += rdlength/*RData*/; in ns_skiprr()
100 if (ptr > eom) in ns_skiprr()
102 _DIAGASSERT(__type_fit(int, ptr - optr)); in ns_skiprr()
[all …]
/bionic/libc/platform/bionic/
Dpac.h33 inline uintptr_t __bionic_clear_pac_bits(uintptr_t ptr) { in __bionic_clear_pac_bits() argument
35 register uintptr_t x30 __asm("x30") = ptr; in __bionic_clear_pac_bits()
40 return ptr; in __bionic_clear_pac_bits()
/bionic/libc/system_properties/
Dcontexts_split.cpp123 static inline int read_spec_entry(char** entry, char** ptr, int* len) { in read_spec_entry() argument
127 while (isspace(**ptr) && **ptr != '\0') (*ptr)++; in read_spec_entry()
129 tmp_buf = *ptr; in read_spec_entry()
132 while (!isspace(**ptr) && **ptr != '\0') { in read_spec_entry()
133 (*ptr)++; in read_spec_entry()
/bionic/libc/malloc_hooks/
Dmalloc_hooks.cpp162 void* ptr = __malloc_hook(size, __builtin_return_address(0)); in hooks_calloc() local
163 if (ptr != nullptr) { in hooks_calloc()
164 memset(ptr, 0, size); in hooks_calloc()
166 return ptr; in hooks_calloc()
189 void* ptr = __memalign_hook(alignment, size, __builtin_return_address(0)); in hooks_aligned_alloc() local
190 if (ptr == nullptr) { in hooks_aligned_alloc()
193 return ptr; in hooks_aligned_alloc()

123