@@ -552,19 +552,20 @@ void free_loc (void* p, const char* file, int line);
552
552
553
553
#endif /* _UMM_MALLOC_CFG_H */
554
554
555
+ #ifdef __cplusplus
556
+ extern "C" {
557
+ #endif
555
558
#ifdef DEBUG_ESP_OOM
556
559
// this must be outside from "#ifndef _UMM_MALLOC_CFG_H"
557
560
// because Arduino.h's <cstdlib> does #undef *alloc
558
561
// Arduino.h recall us to redefine them
559
562
#include <pgmspace.h>
560
563
// Reuse pvPort* calls, since they already support passing location information.
561
- extern "C" {
562
564
void * ICACHE_RAM_ATTR pvPortMalloc (size_t size , const char * file , int line );
563
565
void * ICACHE_RAM_ATTR pvPortCalloc (size_t count , size_t size , const char * file , int line );
564
566
void * ICACHE_RAM_ATTR pvPortRealloc (void * ptr , size_t size , const char * file , int line );
565
567
void * ICACHE_RAM_ATTR pvPortZalloc (size_t size , const char * file , int line );
566
568
void ICACHE_RAM_ATTR vPortFree (void * ptr , const char * file , int line );
567
- };
568
569
#define malloc (s ) ({ static const char mem_debug_file[] PROGMEM STORE_ATTR = __FILE__; pvPortMalloc(s, mem_debug_file, __LINE__); })
569
570
#define calloc (n ,s ) ({ static const char mem_debug_file[] PROGMEM STORE_ATTR = __FILE__; pvPortCalloc(n, s, mem_debug_file, __LINE__); })
570
571
#define realloc (p ,s ) ({ static const char mem_debug_file[] PROGMEM STORE_ATTR = __FILE__; pvPortRealloc(p, s, mem_debug_file, __LINE__); })
@@ -576,10 +577,10 @@ void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line);
576
577
577
578
#elif defined(UMM_POISON_CHECK )
578
579
#include <pgmspace.h>
579
- extern "C" {
580
+
580
581
void * ICACHE_RAM_ATTR pvPortRealloc (void * ptr , size_t size , const char * file , int line );
581
582
void ICACHE_RAM_ATTR vPortFree (void * ptr , const char * file , int line );
582
- };
583
+
583
584
#define realloc (p ,s ) ({ static const char mem_debug_file[] PROGMEM STORE_ATTR = __FILE__; pvPortRealloc(p, s, mem_debug_file, __LINE__); })
584
585
#if 0
585
586
//C
@@ -597,3 +598,7 @@ void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line);
597
598
#endif
598
599
599
600
#endif /* DEBUG_ESP_OOM */
601
+
602
+ #ifdef __cplusplus
603
+ }
604
+ #endif
0 commit comments