Re-org memory allocation interfaces, add --stack-size and --heap-size option (#193)

This commit is contained in:
wenyongh
2020-03-10 19:54:44 +08:00
committed by GitHub
parent 381859d530
commit 0fdd49ea31
110 changed files with 1264 additions and 2125 deletions

View File

@ -8,7 +8,6 @@
#include "event.h"
#include "app_manager.h"
#include "bh_memory.h"
#include "coap_ext.h"
typedef struct _subscribe {
@ -38,7 +37,7 @@ static bool find_subscriber(event_reg_t * reg, uint32 id, bool remove_found)
else
reg->subscribers = next;
bh_free(c);
APP_MGR_FREE(c);
}
return true;
@ -77,7 +76,7 @@ bool am_register_event(const char *url, uint32_t reg_client)
if (current == NULL) {
if (NULL
== (current = (event_reg_t *) bh_malloc(
== (current = (event_reg_t *) APP_MGR_MALLOC(
offsetof(event_reg_t, url) + strlen(url) + 1))) {
app_manager_printf("am_register_event: malloc fail\n");
return false;
@ -92,7 +91,7 @@ bool am_register_event(const char *url, uint32_t reg_client)
if (find_subscriber(current, reg_client, false)) {
return true;
} else {
subscribe_t * s = (subscribe_t*) bh_malloc(sizeof(subscribe_t));
subscribe_t * s = (subscribe_t*) APP_MGR_MALLOC(sizeof(subscribe_t));
if (s == NULL)
return false;
@ -128,7 +127,7 @@ bool am_unregister_event(const char *url, uint32_t reg_client)
pre->next = next;
else
g_events = next;
bh_free(current);
APP_MGR_FREE(current);
current = next;
continue;
}