pkg/wakaama: use ARRAY_SIZE macro
This commit is contained in:
parent
e89ba86244
commit
a0d4f599d8
@ -20,6 +20,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "kernel_defines.h"
|
||||||
#include "liblwm2m.h"
|
#include "liblwm2m.h"
|
||||||
#include "objects/device.h"
|
#include "objects/device.h"
|
||||||
#include "lwm2m_client_config.h"
|
#include "lwm2m_client_config.h"
|
||||||
@ -77,7 +78,7 @@ static uint8_t prv_device_discover(uint16_t instance_id, int *num_dataP,
|
|||||||
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_HW_VERSION,
|
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_HW_VERSION,
|
||||||
LWM2M_RES_SW_VERSION,
|
LWM2M_RES_SW_VERSION,
|
||||||
};
|
};
|
||||||
int len = sizeof(res) / sizeof(uint16_t);
|
int len = ARRAY_SIZE(res);
|
||||||
|
|
||||||
*data_arrayP = lwm2m_data_new(len);
|
*data_arrayP = lwm2m_data_new(len);
|
||||||
if (*data_arrayP == NULL) {
|
if (*data_arrayP == NULL) {
|
||||||
@ -136,7 +137,7 @@ static uint8_t prv_device_read(uint16_t instance_id, int *num_dataP,
|
|||||||
LWM2M_RES_FW_VER, LWM2M_RES_HW_VERSION, LWM2M_RES_SW_VERSION,
|
LWM2M_RES_FW_VER, LWM2M_RES_HW_VERSION, LWM2M_RES_SW_VERSION,
|
||||||
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_ERROR_CODE,
|
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_ERROR_CODE,
|
||||||
};
|
};
|
||||||
int cnt = sizeof(resList) / sizeof(uint16_t);
|
int cnt = ARRAY_SIZE(resList);
|
||||||
*data_arrayP = lwm2m_data_new(cnt);
|
*data_arrayP = lwm2m_data_new(cnt);
|
||||||
if (*data_arrayP == NULL) {
|
if (*data_arrayP == NULL) {
|
||||||
result = COAP_500_INTERNAL_SERVER_ERROR;
|
result = COAP_500_INTERNAL_SERVER_ERROR;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user