Skip to content

Commit ab4d016

Browse files
committed
Implement memory allocation
1 parent 1a32b5b commit ab4d016

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

espnet/espnet.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdint.h>
22
#include <stddef.h>
33
#include <stdio.h>
4+
#include <stdlib.h>
45
#include "espnet.h"
56
#include "freertos/FreeRTOS.h"
67
#include "freertos/semphr.h"
@@ -163,13 +164,6 @@ static int32_t _task_get_max_priority() {
163164
P(_task_get_max_priority)
164165
return 0;
165166
}
166-
static void* _malloc(unsigned int size) {
167-
P(_malloc)
168-
return NULL;
169-
}
170-
static void _free(void *p) {
171-
P(_free)
172-
}
173167
static int32_t _event_post(const char* event_base, int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait) {
174168
P(_event_post)
175169
return 0;
@@ -335,20 +329,17 @@ static void* _zalloc_internal(size_t size) {
335329
return NULL;
336330
}
337331
static void* _wifi_malloc(size_t size) {
338-
P(_wifi_malloc)
339-
return NULL;
332+
return malloc(size);
340333
}
341334
static void* _wifi_realloc(void *ptr, size_t size) {
342335
P(_wifi_realloc)
343336
return NULL;
344337
}
345338
static void* _wifi_calloc(size_t n, size_t size) {
346-
P(_wifi_calloc)
347-
return NULL;
339+
return calloc(n, size);
348340
}
349341
static void* _wifi_zalloc(size_t size) {
350-
P(_wifi_zalloc)
351-
return NULL;
342+
return calloc(1, size);
352343
}
353344
static void* _wifi_create_queue(int queue_len, int item_size) {
354345
P(_wifi_create_queue)
@@ -475,8 +466,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
475466
._task_ms_to_tick = _task_ms_to_tick,
476467
._task_get_current_task = _task_get_current_task,
477468
._task_get_max_priority = _task_get_max_priority,
478-
._malloc = _malloc,
479-
._free = _free,
469+
._malloc = malloc,
470+
._free = free,
480471
._event_post = _event_post,
481472
._get_free_heap_size = _get_free_heap_size,
482473
._rand = _rand,

0 commit comments

Comments
 (0)