quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

user-config-malloc-0-null.h (506B)


      1 /* mbedtls_config.h modifier that forces calloc(0) to return NULL.
      2  * Used for testing.
      3  */
      4 /*
      5  *  Copyright The Mbed TLS Contributors
      6  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
      7  */
      8 
      9 #include <stdlib.h>
     10 
     11 #ifndef MBEDTLS_PLATFORM_STD_CALLOC
     12 static inline void *custom_calloc(size_t nmemb, size_t size)
     13 {
     14     if (nmemb == 0 || size == 0) {
     15         return NULL;
     16     }
     17     return calloc(nmemb, size);
     18 }
     19 
     20 #define MBEDTLS_PLATFORM_MEMORY
     21 #define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
     22 #endif