| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 16 |
|
|
|
#define _GNU_SOURCE |
|
|
|
|
| 17 |
#include "section_list.h" |
#include "section_list.h" |
| 18 |
#include "log.h" |
#include "log.h" |
| 19 |
#include "trie_dict.h" |
#include "trie_dict.h" |
| 46 |
#define ARTICLE_BLOCK_SHM_COUNT_LIMIT 200 // limited by length (8-bit) of proj_id in ftok(path, proj_id) |
#define ARTICLE_BLOCK_SHM_COUNT_LIMIT 200 // limited by length (8-bit) of proj_id in ftok(path, proj_id) |
| 47 |
#define ARTICLE_BLOCK_PER_POOL (ARTICLE_BLOCK_PER_SHM * ARTICLE_BLOCK_SHM_COUNT_LIMIT) |
#define ARTICLE_BLOCK_PER_POOL (ARTICLE_BLOCK_PER_SHM * ARTICLE_BLOCK_SHM_COUNT_LIMIT) |
| 48 |
|
|
| 49 |
#define CALCULATE_PAGE_THRESHOLD 100 // Adjust to tune performance of move topic |
#define CALCULATE_PAGE_THRESHOLD 100 // Adjust to tune performance of moving topic between sections |
| 50 |
|
|
| 51 |
#define SID_STR_LEN 5 // 32-bit + NULL |
#define SID_STR_LEN 5 // 32-bit + NULL |
| 52 |
|
|
| 608 |
p_sid_str[i] = '\0'; |
p_sid_str[i] = '\0'; |
| 609 |
} |
} |
| 610 |
|
|
| 611 |
SECTION_LIST *section_list_create(int32_t sid, const char *sname, const char *stitle, const char *master_name) |
SECTION_LIST *section_list_create(int32_t sid, const char *sname, const char *stitle, const char *master_list) |
| 612 |
{ |
{ |
| 613 |
SECTION_LIST *p_section; |
SECTION_LIST *p_section; |
| 614 |
char sid_str[SID_STR_LEN]; |
char sid_str[SID_STR_LEN]; |
| 637 |
strncpy(p_section->stitle, stitle, sizeof(p_section->stitle) - 1); |
strncpy(p_section->stitle, stitle, sizeof(p_section->stitle) - 1); |
| 638 |
p_section->stitle[sizeof(p_section->stitle) - 1] = '\0'; |
p_section->stitle[sizeof(p_section->stitle) - 1] = '\0'; |
| 639 |
|
|
| 640 |
strncpy(p_section->master_list, master_name, sizeof(p_section->master_list) - 1); |
strncpy(p_section->master_list, master_list, sizeof(p_section->master_list) - 1); |
| 641 |
p_section->master_list[sizeof(p_section->master_list) - 1] = '\0'; |
p_section->master_list[sizeof(p_section->master_list) - 1] = '\0'; |
| 642 |
|
|
| 643 |
if (trie_dict_set(p_section_list_pool->p_trie_dict_section_by_name, sname, p_section_list_pool->section_count) != 1) |
if (trie_dict_set(p_section_list_pool->p_trie_dict_section_by_name, sname, p_section_list_pool->section_count) != 1) |