net: lwm2m: remove "path" from object and resource instances
The path member of the object instance and resource instance structures can easily be removed to save several bytes per instance over the entire LwM2M subsystem. So let's remove it. Example savings when building for nrf52_blenano: SRAM usage before patch: 37952 B SRAM usage after patch: 36576 B Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This commit is contained in:
parent
bba1fe8ca9
commit
2027c10a9f
2 changed files with 3 additions and 14 deletions
|
@ -668,7 +668,6 @@ next_engine_obj_inst(struct lwm2m_engine_obj_inst *last,
|
|||
int lwm2m_create_obj_inst(u16_t obj_id, u16_t obj_inst_id,
|
||||
struct lwm2m_engine_obj_inst **obj_inst)
|
||||
{
|
||||
int i;
|
||||
struct lwm2m_engine_obj *obj;
|
||||
|
||||
*obj_inst = NULL;
|
||||
|
@ -702,14 +701,6 @@ int lwm2m_create_obj_inst(u16_t obj_id, u16_t obj_inst_id,
|
|||
obj->instance_count++;
|
||||
(*obj_inst)->obj = obj;
|
||||
(*obj_inst)->obj_inst_id = obj_inst_id;
|
||||
snprintk((*obj_inst)->path, MAX_RESOURCE_LEN, "%u/%u",
|
||||
obj_id, obj_inst_id);
|
||||
for (i = 0; i < (*obj_inst)->resource_count; i++) {
|
||||
snprintk((*obj_inst)->resources[i].path, MAX_RESOURCE_LEN,
|
||||
"%u/%u/%u", obj_id, obj_inst_id,
|
||||
(*obj_inst)->resources[i].res_id);
|
||||
}
|
||||
|
||||
engine_register_obj_inst(*obj_inst);
|
||||
#ifdef CONFIG_LWM2M_RD_CLIENT_SUPPORT
|
||||
engine_trigger_update();
|
||||
|
@ -1121,9 +1112,10 @@ u16_t lwm2m_get_rd_data(u8_t *client_data, u16_t size)
|
|||
obj_inst, node) {
|
||||
if (obj_inst->obj->obj_id == obj->obj_id) {
|
||||
len = snprintk(temp, sizeof(temp),
|
||||
"%s</%s>",
|
||||
"%s</%u/%u>",
|
||||
(pos > 0) ? "," : "",
|
||||
obj_inst->path);
|
||||
obj_inst->obj->obj_id,
|
||||
obj_inst->obj_inst_id);
|
||||
/*
|
||||
* TODO: iterate through resources once block
|
||||
* transfer is handled correctly
|
||||
|
|
|
@ -211,8 +211,6 @@ struct lwm2m_attr {
|
|||
};
|
||||
|
||||
struct lwm2m_engine_res_inst {
|
||||
char path[MAX_RESOURCE_LEN]; /* 3/0/0 */
|
||||
|
||||
/* runtime field attributes (lwm2m_attr) */
|
||||
sys_slist_t attr_list;
|
||||
|
||||
|
@ -232,7 +230,6 @@ struct lwm2m_engine_obj_inst {
|
|||
/* instance list */
|
||||
sys_snode_t node;
|
||||
|
||||
char path[MAX_RESOURCE_LEN]; /* 3/0 */
|
||||
struct lwm2m_engine_obj *obj;
|
||||
struct lwm2m_engine_res_inst *resources;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue