Home
last modified time | relevance | path

Searched refs:ptr (Results 1 – 25 of 75) 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.cpp162 void BionicSmallObjectAllocator::free(void* ptr) { in free() argument
164 reinterpret_cast<small_object_page_info*>(page_start(reinterpret_cast<uintptr_t>(ptr))); in free()
166 if (reinterpret_cast<uintptr_t>(ptr) % block_size_ != 0) { in free()
167 async_safe_fatal("invalid pointer: %p (block_size=%zd)", ptr, block_size_); in free()
170 memset(ptr, 0, block_size_); in free()
172 reinterpret_cast<small_object_block_record*>(ptr); in free()
325 inline page_info* BionicAllocator::get_page_info_unchecked(void* ptr) { in get_page_info_unchecked() argument
326 uintptr_t header_page = page_start(reinterpret_cast<size_t>(ptr) - kPageInfoSize); in get_page_info_unchecked()
330 inline page_info* BionicAllocator::get_page_info(void* ptr) { in get_page_info() argument
331 page_info* info = get_page_info_unchecked(ptr); in get_page_info()
[all …]
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/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/tests/
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_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 …]
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.cpp223 Character *ptr, *ptr1, *ptr2; member in StringTestState
251 ptr = ptr1 = ptr2 = nullptr; in ResetPointers()
253 ptr = glob_ptr + alignments[align1_index_]; in ResetPointers()
272 memcpy(state.ptr, state.ptr2, 2 * state.MAX_LEN); in TEST()
278 strcpy(state.ptr + state.MAX_LEN - 1, state.ptr1); in TEST()
281 EXPECT_TRUE(memcmp(state.ptr, state.ptr2, 2 * state.MAX_LEN) == 0); in TEST()
529 memcpy(state.ptr, state.ptr1, state.MAX_LEN); in TEST()
534 memset(state.ptr + state.MAX_LEN, '\1', state.MAX_LEN); in TEST()
535 memcpy(state.ptr + state.MAX_LEN, state.ptr1, pos + 1); in TEST()
536 state.ptr[2 * state.MAX_LEN - 1] = '\0'; in TEST()
[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/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/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/libc/private/
Dbionic_allocator.h82 void free(void* ptr);
107 void* realloc(void* ptr, size_t size);
108 void free(void* ptr);
112 size_t get_chunk_size(void* ptr);
117 inline page_info* get_page_info_unchecked(void* ptr);
118 inline page_info* get_page_info(void* ptr);
120 BionicSmallObjectAllocator* get_small_object_allocator(page_info* pi, void* ptr);
DSigSetConverter.h43 ptr = s; in SigSetConverter()
49 ptr = &sigset64; in SigSetConverter()
51 ptr = nullptr; in SigSetConverter()
64 sigset64_t* ptr; member
/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()
194 HENT_SCOPY(hent.h_name, hp->h_name, ptr, len); in _hf_gethtbyname2()
199 ptr, len); in _hf_gethtbyname2()
201 ptr = (void *)ALIGN(ptr); in _hf_gethtbyname2()
202 if ((size_t)(ptr - buf) >= info->buflen) in _hf_gethtbyname2()
208 HENT_COPY(addr_ptrs[num], hp->h_addr_list[0], hp->h_length, ptr, in _hf_gethtbyname2()
221 ptr = info->buf; in _hf_gethtbyname2()
227 HENT_ARRAY(hp->h_aliases, anum, ptr, len); in _hf_gethtbyname2()
228 HENT_ARRAY(hp->h_addr_list, num, ptr, len); in _hf_gethtbyname2()
[all …]
/bionic/benchmarks/
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()
Dmalloc_benchmark.cpp57 void* ptr = malloc(size); in RunMalloptPurge() local
58 if (ptr == nullptr) { in RunMalloptPurge()
61 MakeAllocationResident(ptr, size, pagesize); in RunMalloptPurge()
62 ptrs.push_back(ptr); in RunMalloptPurge()
67 for (auto ptr : ptrs) { in RunMalloptPurge() local
68 free(ptr); in RunMalloptPurge()
120 void* ptr = malloc(size); in RunThreadsThroughput() local
121 MemPool[j] = ptr; in RunThreadsThroughput()
Dstdlib_benchmark.cpp33 void* ptr; in MallocFree() local
34 benchmark::DoNotOptimize(ptr = malloc(nbytes)); in MallocFree()
35 MakeAllocationResident(ptr, nbytes, pagesize); in MallocFree()
36 free(ptr); in MallocFree()
70 void* ptr; in CallocFree() local
71 benchmark::DoNotOptimize(ptr = calloc(1, nbytes)); in CallocFree()
72 MakeAllocationResident(ptr, nbytes, pagesize); in CallocFree()
73 free(ptr); in CallocFree()
/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/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/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()
/bionic/libc/arch-x86_64/bionic/
D__set_tls.c35 __LIBC_HIDDEN__ int __set_tls(void* ptr) { in __set_tls() argument
36 return __arch_prctl(ARCH_SET_FS, (uintptr_t) ptr); in __set_tls()

123