/[LeafOK_CVS]/lbbs/src/section_list.c
ViewVC logotype

Diff of /lbbs/src/section_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.35 by sysadm, Mon Jun 23 08:38:01 2025 UTC Revision 1.41 by sysadm, Tue Oct 14 00:57:06 2025 UTC
# Line 75  typedef struct article_block_pool_t ARTI Line 75  typedef struct article_block_pool_t ARTI
75    
76  static ARTICLE_BLOCK_POOL *p_article_block_pool = NULL;  static ARTICLE_BLOCK_POOL *p_article_block_pool = NULL;
77    
78  struct section_list_pool_t  SECTION_LIST_POOL *p_section_list_pool = NULL;
 {  
         int shmid;  
         SECTION_LIST sections[BBS_max_section];  
         int section_count;  
         int semid;  
         TRIE_NODE *p_trie_dict_section_by_name;  
         TRIE_NODE *p_trie_dict_section_by_sid;  
 };  
 typedef struct section_list_pool_t SECTION_LIST_POOL;  
   
 static SECTION_LIST_POOL *p_section_list_pool = NULL;  
79    
80  int article_block_init(const char *filename, int block_count)  int article_block_init(const char *filename, int block_count)
81  {  {
# Line 630  SECTION_LIST *section_list_create(int32_ Line 619  SECTION_LIST *section_list_create(int32_
619          p_section = p_section_list_pool->sections + p_section_list_pool->section_count;          p_section = p_section_list_pool->sections + p_section_list_pool->section_count;
620    
621          p_section->sid = sid;          p_section->sid = sid;
622            p_section->ex_menu_tm = 0;
623    
624          strncpy(p_section->sname, sname, sizeof(p_section->sname) - 1);          strncpy(p_section->sname, sname, sizeof(p_section->sname) - 1);
625          p_section->sname[sizeof(p_section->sname) - 1] = '\0';          p_section->sname[sizeof(p_section->sname) - 1] = '\0';
# Line 1033  int section_list_page_count_with_ontop(S Line 1023  int section_list_page_count_with_ontop(S
1023                  return -1;                  return -1;
1024          }          }
1025    
1026          page_count = p_section->page_count - 1 +          page_count = p_section->page_count - (p_section->last_page_visible_article_count > 0 ? 1 : 0) +
1027                                   (p_section->last_page_visible_article_count + p_section->ontop_article_count) / BBS_article_limit_per_page +                                   (p_section->last_page_visible_article_count + p_section->ontop_article_count) / BBS_article_limit_per_page +
1028                                   ((p_section->last_page_visible_article_count + p_section->ontop_article_count) % BBS_article_limit_per_page == 0 ? 0 : 1);                                   ((p_section->last_page_visible_article_count + p_section->ontop_article_count) % BBS_article_limit_per_page == 0 ? 0 : 1);
1029    
# Line 1695  int section_list_rd_lock(SECTION_LIST *p Line 1685  int section_list_rd_lock(SECTION_LIST *p
1685                          timer++;                          timer++;
1686                          if (timer % SECTION_TRY_LOCK_TIMES == 0)                          if (timer % SECTION_TRY_LOCK_TIMES == 0)
1687                          {                          {
1688                                  log_error("section_list_rd_lock() tried %d times on section %d\n", sid, timer);                                  log_error("section_list_try_rd_lock() tried %d times on section %d\n", sid, timer);
1689                          }                          }
1690                  }                  }
1691                  else // failed                  else // failed
1692                  {                  {
1693                          log_error("section_list_rd_lock() failed on section %d\n", sid);                          log_error("section_list_try_rd_lock() failed on section %d\n", sid);
1694                          break;                          break;
1695                  }                  }
1696          }          }
# Line 1726  int section_list_rw_lock(SECTION_LIST *p Line 1716  int section_list_rw_lock(SECTION_LIST *p
1716                          timer++;                          timer++;
1717                          if (timer % SECTION_TRY_LOCK_TIMES == 0)                          if (timer % SECTION_TRY_LOCK_TIMES == 0)
1718                          {                          {
1719                                  log_error("acquire_section_rw_lock() tried %d times on section %d\n", sid, timer);                                  log_error("section_list_try_rw_lock() tried %d times on section %d\n", sid, timer);
1720                          }                          }
1721                  }                  }
1722                  else // failed                  else // failed
1723                  {                  {
1724                          log_error("acquire_section_rw_lock() failed on section %d\n", sid);                          log_error("section_list_try_rw_lock() failed on section %d\n", sid);
1725                          break;                          break;
1726                  }                  }
1727          }          }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1