Lines Matching full:if
10 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
20 #if defined(MBEDTLS_MEMORY_BACKTRACE)
24 #if defined(MBEDTLS_THREADING_C)
41 #if defined(MBEDTLS_MEMORY_BACKTRACE)
54 #if defined(MBEDTLS_MEMORY_DEBUG)
62 #if defined(MBEDTLS_THREADING_C)
70 #if defined(MBEDTLS_MEMORY_DEBUG)
73 #if defined(MBEDTLS_MEMORY_BACKTRACE) in debug_header()
84 #if defined(MBEDTLS_MEMORY_BACKTRACE) in debug_header()
115 if (hdr->magic1 != MAGIC1) { in verify_header()
116 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_header()
122 if (hdr->magic2 != MAGIC2) { in verify_header()
123 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_header()
129 if (hdr->alloc > 1) { in verify_header()
130 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_header()
136 if (hdr->prev != NULL && hdr->prev == hdr->next) { in verify_header()
137 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_header()
143 if (hdr->prev_free != NULL && hdr->prev_free == hdr->next_free) { in verify_header()
144 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_header()
157 if (prv == NULL || verify_header(prv) != 0) { in verify_chain()
158 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_chain()
165 if (heap.first->prev != NULL) { in verify_chain()
166 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_chain()
176 if (verify_header(cur) != 0) { in verify_chain()
177 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_chain()
184 if (cur->prev != prv) { in verify_chain()
185 #if defined(MBEDTLS_MEMORY_DEBUG) in verify_chain()
205 #if defined(MBEDTLS_MEMORY_BACKTRACE) in buffer_alloc_calloc()
210 if (heap.buf == NULL || heap.first == NULL) { in buffer_alloc_calloc()
216 if (n == 0 || size == 0 || len / n != size) { in buffer_alloc_calloc()
218 } else if (len > (size_t) -MBEDTLS_MEMORY_ALIGN_MULTIPLE) { in buffer_alloc_calloc()
222 if (len % MBEDTLS_MEMORY_ALIGN_MULTIPLE) { in buffer_alloc_calloc()
230 if (cur->size >= len) { in buffer_alloc_calloc()
237 if (cur == NULL) { in buffer_alloc_calloc()
241 if (cur->alloc != 0) { in buffer_alloc_calloc()
242 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_calloc()
249 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_calloc()
253 // Found location, split block if > memory_header + 4 room left in buffer_alloc_calloc()
255 if (cur->size - len < sizeof(memory_header) + in buffer_alloc_calloc()
261 if (cur->prev_free != NULL) { in buffer_alloc_calloc()
267 if (cur->next_free != NULL) { in buffer_alloc_calloc()
274 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_calloc()
276 if (heap.total_used > heap.maximum_used) { in buffer_alloc_calloc()
280 #if defined(MBEDTLS_MEMORY_BACKTRACE) in buffer_alloc_calloc()
286 if ((heap.verify & MBEDTLS_MEMORY_VERIFY_ALLOC) && verify_chain() != 0) { in buffer_alloc_calloc()
303 #if defined(MBEDTLS_MEMORY_BACKTRACE) in buffer_alloc_calloc()
310 if (new->next != NULL) { in buffer_alloc_calloc()
318 if (new->prev_free != NULL) { in buffer_alloc_calloc()
324 if (new->next_free != NULL) { in buffer_alloc_calloc()
334 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_calloc()
336 if (heap.header_count > heap.maximum_header_count) { in buffer_alloc_calloc()
340 if (heap.total_used > heap.maximum_used) { in buffer_alloc_calloc()
344 #if defined(MBEDTLS_MEMORY_BACKTRACE) in buffer_alloc_calloc()
350 if ((heap.verify & MBEDTLS_MEMORY_VERIFY_ALLOC) && verify_chain() != 0) { in buffer_alloc_calloc()
365 if (ptr == NULL || heap.buf == NULL || heap.first == NULL) { in buffer_alloc_free()
369 if (p < heap.buf || p >= heap.buf + heap.len) { in buffer_alloc_free()
370 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_free()
380 if (verify_header(hdr) != 0) { in buffer_alloc_free()
384 if (hdr->alloc != 1) { in buffer_alloc_free()
385 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_free()
394 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_free()
399 #if defined(MBEDTLS_MEMORY_BACKTRACE) in buffer_alloc_free()
407 if (hdr->prev != NULL && hdr->prev->alloc == 0) { in buffer_alloc_free()
408 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_free()
416 if (hdr->next != NULL) { in buffer_alloc_free()
425 if (hdr->next != NULL && hdr->next->alloc == 0) { in buffer_alloc_free()
426 #if defined(MBEDTLS_MEMORY_DEBUG) in buffer_alloc_free()
433 if (hdr->prev_free != NULL || hdr->next_free != NULL) { in buffer_alloc_free()
434 if (hdr->prev_free != NULL) { in buffer_alloc_free()
440 if (hdr->next_free != NULL) { in buffer_alloc_free()
448 if (hdr->prev_free != NULL) { in buffer_alloc_free()
454 if (hdr->next_free != NULL) { in buffer_alloc_free()
458 if (hdr->next != NULL) { in buffer_alloc_free()
465 // Prepend to free_list if we have not merged in buffer_alloc_free()
468 if (old == NULL) { in buffer_alloc_free()
470 if (heap.first_free != NULL) { in buffer_alloc_free()
476 if ((heap.verify & MBEDTLS_MEMORY_VERIFY_FREE) && verify_chain() != 0) { in buffer_alloc_free()
491 #if defined(MBEDTLS_MEMORY_DEBUG)
503 if (heap.first->next == NULL) { in mbedtls_memory_buffer_alloc_status()
536 #if defined(MBEDTLS_THREADING_C)
540 if (mbedtls_mutex_lock(&heap.mutex) != 0) { in buffer_alloc_calloc_mutexed()
544 if (mbedtls_mutex_unlock(&heap.mutex)) { in buffer_alloc_calloc_mutexed()
554 if (mbedtls_mutex_lock(&heap.mutex)) { in buffer_alloc_free_mutexed()
566 #if defined(MBEDTLS_THREADING_C) in mbedtls_memory_buffer_alloc_init()
574 if (len < sizeof(memory_header) + MBEDTLS_MEMORY_ALIGN_MULTIPLE) { in mbedtls_memory_buffer_alloc_init()
576 } else if ((size_t) buf % MBEDTLS_MEMORY_ALIGN_MULTIPLE) { in mbedtls_memory_buffer_alloc_init()
598 #if defined(MBEDTLS_THREADING_C) in mbedtls_memory_buffer_alloc_free()
604 #if defined(MBEDTLS_SELF_TEST)
607 if (p == NULL) { in check_pointer()
611 if ((size_t) p % MBEDTLS_MEMORY_ALIGN_MULTIPLE != 0) { in check_pointer()
620 if ( in check_all_free()
621 #if defined(MBEDTLS_MEMORY_DEBUG) in check_all_free()
633 if (!(condition)) \
635 if (verbose != 0) \
648 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()
673 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()
677 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()
701 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()
705 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()
734 if (verbose != 0) { in mbedtls_memory_buffer_alloc_self_test()