Skip to content

Commit 0542b40

Browse files
authored
Merge pull request #12537 from DavidLin1577/patch-8
Minor optimization to improve readability of code
2 parents ba94964 + d5f4b8e commit 0542b40

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

features/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/iphc_decompress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static bool decompress_mc_addr(const lowpan_context_list_t *context_list, uint8_
249249
*in_ptr = in;
250250
return true;
251251
case HC_48BIT_CONTEXT_MULTICAST: {
252-
lowpan_context_t *ctx = lowpan_contex_get_by_id(context_list, context);
252+
lowpan_context_t *ctx = lowpan_context_get_by_id(context_list, context);
253253
if (!ctx) {
254254
return false;
255255
}
@@ -312,7 +312,7 @@ static bool decompress_addr(const lowpan_context_list_t *context_list, uint8_t *
312312
}
313313

314314
if (mode & HC_DSTADR_COMP) {
315-
lowpan_context_t *ctx = lowpan_contex_get_by_id(context_list, context);
315+
lowpan_context_t *ctx = lowpan_context_get_by_id(context_list, context);
316316
if (!ctx) {
317317
return false;
318318
}

features/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#define TRACE_GROUP "lCon"
3333

34-
lowpan_context_t *lowpan_contex_get_by_id(const lowpan_context_list_t *list, uint8_t id)
34+
lowpan_context_t *lowpan_context_get_by_id(const lowpan_context_list_t *list, uint8_t id)
3535
{
3636
id &= LOWPAN_CONTEXT_CID_MASK;
3737
/* 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
6565

6666
/* Check to see we already have info for this context */
6767

68-
ctx = lowpan_contex_get_by_id(list, cid);
68+
ctx = lowpan_context_get_by_id(list, cid);
6969
if (ctx) {
7070
//Remove from the list - it will be reinserted below, sorted by its
7171
//new context length. (Don't need "safe" foreach, as we break

features/nanostack/sal-stack-nanostack/source/6LoWPAN/IPHC_Decode/lowpan_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void lowpan_context_timer(lowpan_context_list_t *list, uint_fast16_t ticks);
8888
* \return NULL Not supported Context ID
8989
*
9090
*/
91-
lowpan_context_t *lowpan_contex_get_by_id(const lowpan_context_list_t *list, uint8_t id);
91+
lowpan_context_t *lowpan_context_get_by_id(const lowpan_context_list_t *list, uint8_t id);
9292

9393
/**
9494
* \brief Get Longest match Context entry from the list for given IPv6 address

features/nanostack/sal-stack-nanostack/source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ static void thread_address_registration_tlv_parse(uint8_t *ptr, uint16_t data_le
13981398
ctxId = *ptr++;
13991399
if (ctxId & 0x80) {
14001400
ctxId &= 0x0f;
1401-
ctx = lowpan_contex_get_by_id(&cur->lowpan_contexts, ctxId);
1401+
ctx = lowpan_context_get_by_id(&cur->lowpan_contexts, ctxId);
14021402
if (ctx) {
14031403
memcpy(tempIPv6Address, ctx->prefix, 8);
14041404
memcpy(&tempIPv6Address[8], ptr, 8);

features/nanostack/sal-stack-nanostack/source/BorderRouter/border_router.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ int8_t arm_nwk_6lowpan_border_router_context_update(int8_t interface_id, uint8_t
201201
if (cur->border_router_setup->nd_nwk) {
202202
nd_router_setup_t *routerSetup = cur->border_router_setup->nd_border_router_configure;
203203

204-
if (!lowpan_contex_get_by_id(&routerSetup->context_list, (c_id_flags & LOWPAN_CONTEXT_CID_MASK))) {
204+
if (!lowpan_context_get_by_id(&routerSetup->context_list, (c_id_flags & LOWPAN_CONTEXT_CID_MASK))) {
205205
if (ns_list_count(&routerSetup->context_list) >= ND_MAX_PROXY_CONTEXT_COUNT) {
206206
return -1;
207207
}
@@ -245,7 +245,7 @@ int8_t arm_nwk_6lowpan_border_router_nd_context_load(int8_t interface_id, uint8_
245245
contex_data += 2;
246246
//Now Pointer Indicate to prefix
247247
//Check first is current ID at list
248-
if (!lowpan_contex_get_by_id(&nd_router_setup->context_list, (c_id & LOWPAN_CONTEXT_CID_MASK))) {
248+
if (!lowpan_context_get_by_id(&nd_router_setup->context_list, (c_id & LOWPAN_CONTEXT_CID_MASK))) {
249249
if (ns_list_count(&nd_router_setup->context_list) >= ND_MAX_PROXY_CONTEXT_COUNT) {
250250
tr_debug("All Contexts are allocated");
251251
return -1;
@@ -305,7 +305,7 @@ int8_t arm_nwk_6lowpan_border_router_context_remove_by_id(int8_t interface_id, u
305305

306306
nd_router_configuration = cur_interface->border_router_setup->nd_border_router_configure;
307307

308-
entry = lowpan_contex_get_by_id(&nd_router_configuration->context_list, c_id);
308+
entry = lowpan_context_get_by_id(&nd_router_configuration->context_list, c_id);
309309
if (entry) {
310310
ns_list_remove(&nd_router_configuration->context_list, entry);
311311
ns_dyn_mem_free(entry);
@@ -333,7 +333,7 @@ int8_t arm_nwk_6lowpan_border_router_context_parameter_update(int8_t interface_i
333333

334334
nd_router_configuration = cur_interface->border_router_setup->nd_border_router_configure;
335335

336-
entry = lowpan_contex_get_by_id(&nd_router_configuration->context_list, c_id);
336+
entry = lowpan_context_get_by_id(&nd_router_configuration->context_list, c_id);
337337
if (entry) {
338338
uint8_t cid_flag = entry->cid;
339339
entry->compression = compress_mode;

0 commit comments

Comments
 (0)