Merge pull request #12537 from DavidLin1577/patch-8

Minor optimization to improve readability of code
pull/12513/head
Martin Kojtal 2020-03-04 13:23:08 +00:00 committed by GitHub
commit 0542b40f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -249,7 +249,7 @@ static bool decompress_mc_addr(const lowpan_context_list_t *context_list, uint8_
*in_ptr = in;
return true;
case HC_48BIT_CONTEXT_MULTICAST: {
lowpan_context_t *ctx = lowpan_contex_get_by_id(context_list, context);
lowpan_context_t *ctx = lowpan_context_get_by_id(context_list, context);
if (!ctx) {
return false;
}
@ -312,7 +312,7 @@ static bool decompress_addr(const lowpan_context_list_t *context_list, uint8_t *
}
if (mode & HC_DSTADR_COMP) {
lowpan_context_t *ctx = lowpan_contex_get_by_id(context_list, context);
lowpan_context_t *ctx = lowpan_context_get_by_id(context_list, context);
if (!ctx) {
return false;
}

View File

@ -31,7 +31,7 @@
#define TRACE_GROUP "lCon"
lowpan_context_t *lowpan_contex_get_by_id(const lowpan_context_list_t *list, uint8_t id)
lowpan_context_t *lowpan_context_get_by_id(const lowpan_context_list_t *list, uint8_t id)
{
id &= LOWPAN_CONTEXT_CID_MASK;
/* Check to see we already have info for this context */
@ -65,7 +65,7 @@ int_fast8_t lowpan_context_update(lowpan_context_list_t *list, uint8_t cid_flags
/* Check to see we already have info for this context */
ctx = lowpan_contex_get_by_id(list, cid);
ctx = lowpan_context_get_by_id(list, cid);
if (ctx) {
//Remove from the list - it will be reinserted below, sorted by its
//new context length. (Don't need "safe" foreach, as we break

View File

@ -88,7 +88,7 @@ void lowpan_context_timer(lowpan_context_list_t *list, uint_fast16_t ticks);
* \return NULL Not supported Context ID
*
*/
lowpan_context_t *lowpan_contex_get_by_id(const lowpan_context_list_t *list, uint8_t id);
lowpan_context_t *lowpan_context_get_by_id(const lowpan_context_list_t *list, uint8_t id);
/**
* \brief Get Longest match Context entry from the list for given IPv6 address

View File

@ -1398,7 +1398,7 @@ static void thread_address_registration_tlv_parse(uint8_t *ptr, uint16_t data_le
ctxId = *ptr++;
if (ctxId & 0x80) {
ctxId &= 0x0f;
ctx = lowpan_contex_get_by_id(&cur->lowpan_contexts, ctxId);
ctx = lowpan_context_get_by_id(&cur->lowpan_contexts, ctxId);
if (ctx) {
memcpy(tempIPv6Address, ctx->prefix, 8);
memcpy(&tempIPv6Address[8], ptr, 8);

View File

@ -201,7 +201,7 @@ int8_t arm_nwk_6lowpan_border_router_context_update(int8_t interface_id, uint8_t
if (cur->border_router_setup->nd_nwk) {
nd_router_setup_t *routerSetup = cur->border_router_setup->nd_border_router_configure;
if (!lowpan_contex_get_by_id(&routerSetup->context_list, (c_id_flags & LOWPAN_CONTEXT_CID_MASK))) {
if (!lowpan_context_get_by_id(&routerSetup->context_list, (c_id_flags & LOWPAN_CONTEXT_CID_MASK))) {
if (ns_list_count(&routerSetup->context_list) >= ND_MAX_PROXY_CONTEXT_COUNT) {
return -1;
}
@ -245,7 +245,7 @@ int8_t arm_nwk_6lowpan_border_router_nd_context_load(int8_t interface_id, uint8_
contex_data += 2;
//Now Pointer Indicate to prefix
//Check first is current ID at list
if (!lowpan_contex_get_by_id(&nd_router_setup->context_list, (c_id & LOWPAN_CONTEXT_CID_MASK))) {
if (!lowpan_context_get_by_id(&nd_router_setup->context_list, (c_id & LOWPAN_CONTEXT_CID_MASK))) {
if (ns_list_count(&nd_router_setup->context_list) >= ND_MAX_PROXY_CONTEXT_COUNT) {
tr_debug("All Contexts are allocated");
return -1;
@ -305,7 +305,7 @@ int8_t arm_nwk_6lowpan_border_router_context_remove_by_id(int8_t interface_id, u
nd_router_configuration = cur_interface->border_router_setup->nd_border_router_configure;
entry = lowpan_contex_get_by_id(&nd_router_configuration->context_list, c_id);
entry = lowpan_context_get_by_id(&nd_router_configuration->context_list, c_id);
if (entry) {
ns_list_remove(&nd_router_configuration->context_list, entry);
ns_dyn_mem_free(entry);
@ -333,7 +333,7 @@ int8_t arm_nwk_6lowpan_border_router_context_parameter_update(int8_t interface_i
nd_router_configuration = cur_interface->border_router_setup->nd_border_router_configure;
entry = lowpan_contex_get_by_id(&nd_router_configuration->context_list, c_id);
entry = lowpan_context_get_by_id(&nd_router_configuration->context_list, c_id);
if (entry) {
uint8_t cid_flag = entry->cid;
entry->compression = compress_mode;