feat(mdns): Support user defined allocators

Defines mem-alloc function optionally weak, so users can override them
and implement their own allocation, or a static/bss memory for the mdns
task stack.
This commit is contained in:
David Cermak
2025-02-13 15:26:23 +01:00
parent e65f22ab6c
commit 88162d1f3a
7 changed files with 109 additions and 62 deletions

View File

@ -126,16 +126,6 @@ uint32_t esp_log_timestamp(void)
return 0;
}
void *heap_caps_malloc(size_t size, uint32_t caps)
{
return malloc(size);
}
void heap_caps_free(void *ptr)
{
free(ptr);
}
void *mdns_mem_malloc(size_t size)
{
return malloc(size);
@ -160,3 +150,13 @@ char *mdns_mem_strndup(const char *s, size_t n)
{
return strndup(s, n);
}
void *mdns_mem_task_malloc(size_t size)
{
return malloc(size);
}
void mdns_mem_task_free(void *ptr)
{
free(ptr);
}