| 577 |
SECTION_LIST *section_list_find_by_name(const char *sname) |
SECTION_LIST *section_list_find_by_name(const char *sname) |
| 578 |
{ |
{ |
| 579 |
int64_t index; |
int64_t index; |
| 580 |
|
int ret; |
| 581 |
|
|
| 582 |
if (p_section_list_pool == NULL) |
if (p_section_list_pool == NULL) |
| 583 |
{ |
{ |
| 585 |
return NULL; |
return NULL; |
| 586 |
} |
} |
| 587 |
|
|
| 588 |
if (trie_dict_get(p_section_list_pool->p_trie_dict_section_by_name, sname, &index) != 1) |
ret = trie_dict_get(p_section_list_pool->p_trie_dict_section_by_name, sname, &index); |
| 589 |
|
if (ret < 0) |
| 590 |
{ |
{ |
| 591 |
log_error("trie_dict_get(section, %s) error\n", sname); |
log_error("trie_dict_get(section, %s) error\n", sname); |
| 592 |
return NULL; |
return NULL; |
| 593 |
} |
} |
| 594 |
|
else if (ret == 0) |
| 595 |
|
{ |
| 596 |
|
return NULL; |
| 597 |
|
} |
| 598 |
|
|
| 599 |
return (p_section_list_pool->sections + index); |
return (p_section_list_pool->sections + index); |
| 600 |
} |
} |
| 602 |
SECTION_LIST *section_list_find_by_sid(int32_t sid) |
SECTION_LIST *section_list_find_by_sid(int32_t sid) |
| 603 |
{ |
{ |
| 604 |
int64_t index; |
int64_t index; |
| 605 |
|
int ret; |
| 606 |
char sid_str[SID_STR_LEN]; |
char sid_str[SID_STR_LEN]; |
| 607 |
|
|
| 608 |
if (p_section_list_pool == NULL) |
if (p_section_list_pool == NULL) |
| 613 |
|
|
| 614 |
sid_to_str(sid, sid_str); |
sid_to_str(sid, sid_str); |
| 615 |
|
|
| 616 |
if (trie_dict_get(p_section_list_pool->p_trie_dict_section_by_sid, sid_str, &index) != 1) |
ret = trie_dict_get(p_section_list_pool->p_trie_dict_section_by_sid, sid_str, &index); |
| 617 |
|
if (ret < 0) |
| 618 |
{ |
{ |
| 619 |
log_error("trie_dict_get(section, %d) error\n", sid); |
log_error("trie_dict_get(section, %d) error\n", sid); |
| 620 |
return NULL; |
return NULL; |
| 621 |
} |
} |
| 622 |
|
else if (ret == 0) |
| 623 |
|
{ |
| 624 |
|
return NULL; |
| 625 |
|
} |
| 626 |
|
|
| 627 |
return (p_section_list_pool->sections + index); |
return (p_section_list_pool->sections + index); |
| 628 |
} |
} |