Skip to content

Commit 950bb04

Browse files
earlephilhowerd-a-v
authored andcommitted
Remove unused ax_port_*alloc() functions (esp8266#3482)
The ax_port_malloc, ax_port_calloc, ax_port_realloc, and ax_port_free functions in WiFiClientSecure are not actually used by the AXTLS library. It's directly using the library routines, and these function are never used. Remove these dead bits of code to make the axtls operation clearer.
1 parent d997fe5 commit 950bb04

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecure.cpp

-47
Original file line numberDiff line numberDiff line change
@@ -657,53 +657,6 @@ extern "C" int __ax_get_file(const char *filename, uint8_t **buf)
657657
}
658658
extern "C" void ax_get_file() __attribute__ ((weak, alias("__ax_get_file")));
659659

660-
661-
#ifdef DEBUG_TLS_MEM
662-
#define DEBUG_TLS_MEM_PRINT(...) DEBUGV(__VA_ARGS__)
663-
#else
664-
#define DEBUG_TLS_MEM_PRINT(...)
665-
#endif
666-
667-
extern "C" void* ax_port_malloc(size_t size, const char* file, int line)
668-
{
669-
(void) file;
670-
(void) line;
671-
void* result = malloc(size);
672-
if (result == nullptr) {
673-
DEBUG_TLS_MEM_PRINT("%s:%d malloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());
674-
}
675-
if (size >= 1024) {
676-
DEBUG_TLS_MEM_PRINT("%s:%d malloc %d, left %d\r\n", file, line, size, ESP.getFreeHeap());
677-
}
678-
return result;
679-
}
680-
681-
extern "C" void* ax_port_calloc(size_t size, size_t count, const char* file, int line)
682-
{
683-
void* result = ax_port_malloc(size * count, file, line);
684-
memset(result, 0, size * count);
685-
return result;
686-
}
687-
688-
extern "C" void* ax_port_realloc(void* ptr, size_t size, const char* file, int line)
689-
{
690-
(void) file;
691-
(void) line;
692-
void* result = realloc(ptr, size);
693-
if (result == nullptr) {
694-
DEBUG_TLS_MEM_PRINT("%s:%d realloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());
695-
}
696-
if (size >= 1024) {
697-
DEBUG_TLS_MEM_PRINT("%s:%d realloc %d, left %d\r\n", file, line, size, ESP.getFreeHeap());
698-
}
699-
return result;
700-
}
701-
702-
extern "C" void ax_port_free(void* ptr)
703-
{
704-
free(ptr);
705-
}
706-
707660
extern "C" void __ax_wdt_feed()
708661
{
709662
optimistic_yield(10000);

0 commit comments

Comments
 (0)