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

Diff of /lbbs/src/test_section_list.c

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

Revision 1.1 by sysadm, Wed May 21 04:07:42 2025 UTC Revision 1.17 by sysadm, Fri May 23 14:04:05 2025 UTC
# Line 21  Line 21 
21  #include <unistd.h>  #include <unistd.h>
22  #include <errno.h>  #include <errno.h>
23    
24    #define ARTICLE_BLOCK_SHM_FILE "~article_block_shm.dat"
25    #define SECTION_LIST_SHM_FILE "~section_list_shm.dat"
26    
27  const char *sname[] = {  const char *sname[] = {
28          "Test",          "Test",
29          "ABCDEFG",          "ABCDEFG",
30          "_1234_"          "_1234_"};
 };  
31    
32  const char *stitle[] = {  const char *stitle[] = {
33          " Test Section ",          " Test Section ",
34          "字母组合ABC",          "字母组合ABC",
35          "_数字_123"          "_数字_123"};
 };  
36    
37  const char *master_name[] = {  const char *master_name[] = {
38          "sysadm",          "sysadm",
39          "SYSOP",          "SYSOP",
40          ""          ""};
 };  
41    
42  int section_count = 3;  int section_conf_count = 3;
43    int section_count = BBS_max_section;
44    
45  int main(int argc, char *argv[])  int main(int argc, char *argv[])
46  {  {
47          SECTION_DATA *p_section[BBS_max_section];          SECTION_LIST *p_section[BBS_max_section];
48            ARTICLE *p_article;
49            ARTICLE *p_next;
50          ARTICLE article;          ARTICLE article;
51            int block_count;
52          int i, j;          int i, j;
53          int last_aid;          int last_aid;
54            int current_tid;
55            int section_first_aid;
56            int group_count = 100;
57            int article_count;
58            int step;
59            int32_t page;
60            int32_t offset;
61            int affected_count;
62            FILE *fp;
63    
64          if (log_begin("../log/bbsd.log", "../log/error.log") < 0)          if (log_begin("../log/bbsd.log", "../log/error.log") < 0)
65          {          {
# Line 57  int main(int argc, char *argv[]) Line 70  int main(int argc, char *argv[])
70          log_std_redirect(STDOUT_FILENO);          log_std_redirect(STDOUT_FILENO);
71          log_err_redirect(STDERR_FILENO);          log_err_redirect(STDERR_FILENO);
72    
73          if (section_data_pool_init("../conf/menu.conf", BBS_article_block_limit_per_section * BBS_max_section) < 0)          // - 1 to make blocks allocated is less than required, to trigger error handling
74            block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK;
75    
76            if ((fp = fopen(ARTICLE_BLOCK_SHM_FILE, "w")) == NULL)
77            {
78                    log_error("fopen(%s) error\n", ARTICLE_BLOCK_SHM_FILE);
79                    return -1;
80            }
81            fclose(fp);
82    
83            if ((fp = fopen(SECTION_LIST_SHM_FILE, "w")) == NULL)
84          {          {
85                  log_error("section_data_pool_init() error\n");                  log_error("fopen(%s) error\n", SECTION_LIST_SHM_FILE);
86                    return -1;
87            }
88            fclose(fp);
89    
90            if (article_block_init(ARTICLE_BLOCK_SHM_FILE, block_count) < 0)
91            {
92                    log_error("section_data_pool_init(%s, %d) error\n", ARTICLE_BLOCK_SHM_FILE, block_count);
93                  return -2;                  return -2;
94          }          }
95    
96            if (section_list_pool_init(SECTION_LIST_SHM_FILE) < 0)
97            {
98                    log_error("section_list_pool_init(%s) error\n", SECTION_LIST_SHM_FILE);
99                    return -2;
100            }
101    
102            printf("Testing #1 ...\n");
103    
104          last_aid = 0;          last_aid = 0;
105    
106          for (i = 0; i < section_count; i++)          for (i = 0; i < section_count; i++)
107          {          {
108                  if ((p_section[i] = section_data_create(sname[i], stitle[i], master_name[i])) == NULL)                  p_section[i] = section_list_create(i + 1,
109                                                                                       sname[i % section_conf_count],
110                                                                                       stitle[i % section_conf_count],
111                                                                                       master_name[i % section_conf_count]);
112                    if (p_section[i] == NULL)
113                  {                  {
114                          log_error("section_data_create(i=%d) error\n", i);                          log_error("section_data_create(i=%d) error\n", i);
115                          return -3;                          return -3;
116                  }                  }
117            }
118    
119            for (i = 0; i < section_conf_count; i++)
120            {
121                    if (section_list_find_by_name(sname[i]) == NULL)
122                    {
123                            printf("section_data_find_section_by_name(%s) error\n", sname[i]);
124                            return -3;
125                    }
126            }
127    
128                  for (j = 0; j < BBS_article_limit_per_block * BBS_article_block_limit_per_section; j++)          for (j = 0; j < BBS_article_limit_per_section; j++)
129            {
130                    for (i = 0; i < section_count; i++)
131                  {                  {
132                          last_aid++;                          last_aid++;
133    
# Line 87  int main(int argc, char *argv[]) Line 141  int main(int argc, char *argv[])
141                          article.ontop = 0;                          article.ontop = 0;
142                          article.lock = 0;                          article.lock = 0;
143    
144                          section_data_append_article(p_section[i], &article);                          if (section_list_append_article(p_section[i], &article) < 0)
145                            {
146                                    printf("append article (aid = %d) error at section %d index %d\n", article.aid, i, j);
147                                    break;
148                            }
149                  }                  }
150          }          }
151    
152          for (i = 0; i < section_count; i++)          for (i = 0; i < section_count; i++)
153          {          {
154                  if (section_data_free_block(p_section[i]) != 0)                  // printf("Loaded %d articles into section %d\n", p_section[i]->article_count, i);
155            }
156    
157            last_aid = 0;
158    
159            for (i = 0; i < section_count; i++)
160            {
161                    if (p_section[i]->article_count == 0)
162                  {                  {
163                          log_error("section_data_free_block(i=%d) error\n", i);                          continue;
                         return -4;  
164                  }                  }
165    
166                    for (j = 0; j < p_section[i]->article_count; j++)
167                    {
168                            last_aid++;
169    
170                            p_article = article_block_find_by_aid(last_aid);
171                            if (p_article == NULL || p_article->aid != last_aid)
172                            {
173                                    printf("article_block_find_by_aid() at section %d index %d, %d != %d\n", i, j, p_article->aid, last_aid);
174                            }
175    
176                            p_article = article_block_find_by_index(last_aid - 1);
177                            if (p_article == NULL || p_article->aid != last_aid)
178                            {
179                                    printf("article_block_find_by_index() at section %d index %d, %d != %d\n", i, j, p_article->aid, last_aid);
180                            }
181    
182                            if (section_list_set_article_visible(p_section[i], p_article->aid, 0) != 1)
183                            {
184                                    printf("section_list_set_article_visible(aid = %d) error\n", p_article->aid);
185                            }
186                    }
187    
188                    // printf("Verified %d articles in section %d\n", p_section[i]->article_count, i);
189          }          }
190    
191          section_data_pool_cleanup();          printf("Testing #2 ...\n");
192    
193            if (article_block_reset() != 0)
194            {
195                    log_error("section_data_free_block(i=%d) error\n", i);
196                    return -4;
197            }
198    
199            for (i = 0; i < section_count; i++)
200            {
201                    section_list_reset_articles(p_section[i]);
202            }
203    
204            last_aid = 0;
205    
206            for (i = 0; i < section_count; i++)
207            {
208                    section_first_aid = last_aid + 1;
209    
210                    for (j = 0; j < BBS_article_limit_per_section; j++)
211                    {
212                            last_aid++;
213    
214                            // Set article data
215                            article.aid = last_aid;
216                            article.cid = article.aid;
217                            // Group articles into group_count topics
218                            article.tid = ((article.aid < section_first_aid + group_count) ? 0 : (section_first_aid + j % group_count));
219                            article.uid = 1; // TODO: randomize
220                            article.visible = 1;
221                            article.excerption = 0;
222                            article.ontop = 0;
223                            article.lock = 0;
224    
225                            if (section_list_append_article(p_section[i], &article) < 0)
226                            {
227                                    printf("append article (aid = %d) error at section %d index %d\n", article.aid, i, j);
228                                    break;
229                            }
230                    }
231    
232                    // printf("Loaded %d articles into section %d\n", p_section[i]->article_count, i);
233            }
234    
235            for (i = 0; i < section_count; i++)
236            {
237                    if (p_section[i]->article_count == 0)
238                    {
239                            continue;
240                    }
241    
242                    article_count = 0;
243                    last_aid = 0;
244    
245                    p_article = p_section[i]->p_article_head;
246    
247                    do
248                    {
249                            article_count++;
250    
251                            if (p_article->aid <= last_aid)
252                            {
253                                    printf("Non-ascending aid found %d <= %d at article\n", p_article->aid, last_aid);
254                            }
255                            last_aid = p_article->aid;
256    
257                            p_article = p_article->p_next;
258                    } while (p_article != p_section[i]->p_article_head);
259    
260                    if (article_count != p_section[i]->article_count)
261                    {
262                            printf("Count of articles in section %d is different from expected %d != %d\n",
263                                       i, article_count, p_section[i]->article_count);
264                            break;
265                    }
266    
267                    // printf("Verified %d articles in section %d\n", group_count, i);
268            }
269    
270            for (i = 0; i < section_count; i++)
271            {
272                    if (p_section[i]->article_count == 0)
273                    {
274                            continue;
275                    }
276    
277                    if (p_section[i]->topic_count != group_count)
278                    {
279                            printf("Inconsistent topic count in section %d, %d != %d\n", i, p_section[i]->topic_count, group_count);
280                    }
281    
282                    for (j = 0; j < group_count; j++)
283                    {
284                            last_aid = p_section[i]->p_article_head->aid + j;
285    
286                            p_article = article_block_find_by_aid(last_aid);
287                            if (p_article == NULL)
288                            {
289                                    printf("NULL p_article at section %d index %d\n", i, j);
290                                    break;
291                            }
292                            if (p_article->aid != last_aid)
293                            {
294                                    printf("Inconsistent aid at section %d index %d, %d != %d\n", i, j, p_article->aid, last_aid);
295                                    break;
296                            }
297    
298                            article_count = 1;
299                            last_aid = 0;
300                            current_tid = p_article->aid;
301    
302                            do
303                            {
304                                    if (p_article->aid <= last_aid)
305                                    {
306                                            printf("Non-ascending aid found %d <= %d\n", p_article->aid, last_aid);
307                                    }
308                                    last_aid = p_article->aid;
309    
310                                    p_article = p_article->p_topic_next;
311    
312                                    if (p_article == NULL)
313                                    {
314                                            printf("NULL p_article found\n");
315                                            break;
316                                    }
317                                    if (p_article->tid == 0) // loop
318                                    {
319                                            break;
320                                    }
321                                    if (p_article->tid != current_tid)
322                                    {
323                                            printf("Inconsistent tid %d != %d\n", p_article->tid, current_tid);
324                                            break;
325                                    }
326    
327                                    article_count++;
328                            } while (1);
329    
330                            if (article_count != p_section[i]->article_count / group_count)
331                            {
332                                    printf("Count of articles in topic %d is different from expected %d != %d\n",
333                                               j + 1, article_count, p_section[i]->article_count / group_count);
334                                    // break;
335                            }
336                    }
337    
338                    // printf("Verified %d topics in section %d\n", group_count, i);
339            }
340    
341            printf("Testing #3 ...\n");
342    
343            for (i = 0; i < section_count; i++)
344            {
345                    last_aid = 0;
346    
347                    for (j = 0; j < p_section[i]->page_count; j++)
348                    {
349                            if (p_section[i]->p_page_first_article[j]->aid <= last_aid)
350                            {
351                                    printf("Non-ascending aid found at section %d page %d, %d <= %d\n", i, j, p_section[i]->p_page_first_article[j]->aid, last_aid);
352                            }
353    
354                            if (j > 0)
355                            {
356                                    step = 0;
357    
358                                    for (p_article = p_section[i]->p_page_first_article[j];
359                                             p_article != p_section[i]->p_page_first_article[j - 1];
360                                             p_article = p_article->p_prior)
361                                    {
362                                            step++;
363                                    }
364    
365                                    if (step != BBS_article_limit_per_page)
366                                    {
367                                            printf("Incorrect page size %d at section %d page %d\n", step, i, j - 1);
368                                    }
369                            }
370                    }
371            }
372    
373            printf("Testing #4 ...\n");
374    
375            for (i = 0; i < section_count; i++)
376            {
377                    step = i % 10 + 1;
378                    for (j = group_count; j < BBS_article_limit_per_section; j += step)
379                    {
380                            last_aid = i * BBS_article_limit_per_section + j + 1;
381    
382                            p_article = section_list_find_article_with_offset(p_section[i], last_aid, &page, &offset, &p_next);
383    
384                            if (p_article == NULL)
385                            {
386                                    printf("Error find article %d in section %d offset %d\n", last_aid, i, j);
387                                    break;
388                            }
389    
390                            if (p_article->aid != last_aid)
391                            {
392                                    printf("Inconsistent article aid in section %d page %d offset %d %d != %d\n", i, page, offset, p_article->aid, last_aid);
393                                    break;
394                            }
395    
396                            if (section_list_set_article_visible(p_section[i], last_aid, 0) != 1)
397                            {
398                                    printf("Error set article %d invisible in section %d offset %d\n", last_aid, i, j);
399                                    break;
400                            }
401                    }
402    
403                    last_aid = p_section[i]->p_article_head->aid;
404                    if (section_list_calculate_page(p_section[i], last_aid) < 0)
405                    {
406                            printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j);
407                            break;
408                    }
409    
410                    if (p_section[i]->visible_article_count / BBS_article_limit_per_page +
411                                    (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
412                            p_section[i]->page_count)
413                    {
414                            printf("Inconsistent page count in section %d offset %d, %d != %d, "
415                                       "visible_article_count = %d, last_page_visible_count = %d\n",
416                                       i, j,
417                                       p_section[i]->visible_article_count / BBS_article_limit_per_page +
418                                               (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0),
419                                       p_section[i]->page_count, p_section[i]->visible_article_count,
420                                       p_section[i]->last_page_visible_article_count);
421                            break;
422                    }
423    
424                    affected_count = (BBS_article_limit_per_section - group_count) / step + ((BBS_article_limit_per_section - group_count) % step ? 1 : 0);
425                    if (p_section[i]->article_count - p_section[i]->visible_article_count != affected_count)
426                    {
427                            printf("Inconsistent set invisible count in section %d, %d != %d\n", i,
428                                       p_section[i]->article_count - p_section[i]->visible_article_count,
429                                       affected_count);
430                            break;
431                    }
432    
433                    article_count = p_section[i]->visible_article_count;
434    
435                    for (j = 0; j < group_count; j += 1)
436                    {
437                            last_aid = i * BBS_article_limit_per_section + j + 1;
438    
439                            p_article = section_list_find_article_with_offset(p_section[i], last_aid, &page, &offset, &p_next);
440    
441                            if (p_article == NULL)
442                            {
443                                    printf("Error find article %d in section %d offset %d\n", last_aid, i, j);
444                                    break;
445                            }
446    
447                            if (p_article->aid != last_aid)
448                            {
449                                    printf("Inconsistent article aid in section %d page %d offset %d %d != %d\n", i, page, offset, p_article->aid, last_aid);
450                                    break;
451                            }
452    
453                            if (p_article->tid != 0)
454                            {
455                                    printf("Non-topic article aid in section %d page %d offset %d %d != 0\n", i, page, offset, p_article->tid);
456                                    break;
457                            }
458    
459                            if ((affected_count = section_list_set_article_visible(p_section[i], last_aid, 0)) <= 0)
460                            {
461                                    printf("Error set topic %d invisible in section %d offset %d\n", last_aid, i, j);
462                                    break;
463                            }
464    
465                            article_count -= affected_count;
466                    }
467    
468                    if (article_count != 0)
469                    {
470                            printf("Inconsistent total set invisible topic count in section %d, %d > 0\n", i, article_count);
471                            break;
472                    }
473    
474                    if (p_section[i]->visible_article_count > 0)
475                    {
476                            printf("Inconsistent invisible article count in section %d, %d > 0\n", i, p_section[i]->visible_article_count);
477                            break;
478                    }
479    
480                    if (p_section[i]->visible_topic_count > 0)
481                    {
482                            printf("Inconsistent invisible topic count in section %d, %d > 0\n", i, p_section[i]->visible_topic_count);
483                            break;
484                    }
485    
486                    last_aid = p_section[i]->p_article_head->aid;
487                    if (section_list_calculate_page(p_section[i], last_aid) < 0)
488                    {
489                            printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j);
490                            break;
491                    }
492    
493                    if (p_section[i]->visible_article_count / BBS_article_limit_per_page +
494                                    (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
495                            p_section[i]->page_count)
496                    {
497                            printf("Inconsistent page count in section %d offset %d, %d != %d, "
498                                       "visible_article_count = %d, last_page_visible_count = %d\n",
499                                       i, j,
500                                       p_section[i]->visible_article_count / BBS_article_limit_per_page +
501                                               (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0),
502                                       p_section[i]->page_count, p_section[i]->visible_article_count,
503                                       p_section[i]->last_page_visible_article_count);
504                            break;
505                    }
506            }
507    
508            for (i = 0; i < BBS_max_section; i++)
509            {
510                    affected_count = 0;
511    
512                    for (j = 0; j < BBS_article_limit_per_section; j += 1)
513                    {
514                            last_aid = i * BBS_article_limit_per_section + j + 1;
515    
516                            if (section_list_set_article_visible(p_section[i], last_aid, 1) <= 0)
517                            {
518                                    printf("Error set article %d visible in section %d offset %d\n", last_aid, i, j);
519                                    break;
520                            }
521    
522                            affected_count++;
523                    }
524    
525                    if (affected_count != p_section[i]->article_count)
526                    {
527                            printf("Inconsistent total set visible article count in section %d, %d != %d\n", i, affected_count, p_section[i]->article_count);
528                            break;
529                    }
530    
531                    if (p_section[i]->visible_article_count != p_section[i]->article_count)
532                    {
533                            printf("Inconsistent visible article count in section %d, %d != %d\n", i, p_section[i]->visible_article_count, p_section[i]->article_count);
534                            break;
535                    }
536    
537                    if (p_section[i]->visible_topic_count != group_count)
538                    {
539                            printf("Inconsistent visible topic count in section %d, %d != %d\n", i, p_section[i]->visible_topic_count, group_count);
540                            break;
541                    }
542    
543                    last_aid = p_section[i]->p_article_head->aid;
544                    if (section_list_calculate_page(p_section[i], last_aid) < 0)
545                    {
546                            printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j);
547                            break;
548                    }
549    
550                    if (p_section[i]->visible_article_count / BBS_article_limit_per_page +
551                                    (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
552                            p_section[i]->page_count)
553                    {
554                            printf("Inconsistent page count in section %d offset %d, %d != %d, "
555                                       "visible_article_count = %d, last_page_visible_count = %d\n",
556                                       i, j,
557                                       p_section[i]->visible_article_count / BBS_article_limit_per_page +
558                                               (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0),
559                                       p_section[i]->page_count, p_section[i]->visible_article_count,
560                                       p_section[i]->last_page_visible_article_count);
561                            break;
562                    }
563            }
564    
565            printf("Testing #5 ...\n");
566    
567            if (article_block_reset() != 0)
568            {
569                    log_error("section_data_free_block(i=%d) error\n", i);
570                    return -4;
571            }
572    
573            for (i = 0; i < section_count; i++)
574            {
575                    section_list_reset_articles(p_section[i]);
576            }
577    
578            last_aid = 0;
579    
580            for (i = 0; i < section_count / 2; i++)
581            {
582                    section_first_aid = last_aid + 1;
583    
584                    for (j = 0; j < BBS_article_limit_per_section; j++)
585                    {
586                            last_aid++;
587    
588                            // Set article data
589                            article.aid = last_aid;
590                            article.cid = article.aid;
591                            // Group articles into group_count topics
592                            article.tid = ((article.aid < section_first_aid + group_count) ? 0 : (section_first_aid + j % group_count));
593                            article.uid = 1; // TODO: randomize
594                            article.visible = 1;
595                            article.excerption = 0;
596                            article.ontop = 0;
597                            article.lock = 0;
598    
599                            if (section_list_append_article(p_section[i], &article) < 0)
600                            {
601                                    printf("append article (aid = %d) error at section %d index %d\n", article.aid, i, j);
602                                    break;
603                            }
604                    }
605    
606                    // printf("Loaded %d articles into section %d\n", p_section[i]->article_count, i);
607            }
608    
609            for (i = 0; i < section_count / 2; i++)
610            {
611                    section_first_aid = p_section[i]->p_article_head->aid;
612    
613                    for (j = 0; j < group_count; j += 2)
614                    {
615                            p_article = section_list_find_article_with_offset(p_section[i], section_first_aid + j, &page, &offset, &p_next);
616                            if (p_article == NULL)
617                            {
618                                    printf("section_list_find_article_with_offset(aid = %d) not found in section %d\n",
619                                               section_first_aid + j, i);
620                                    break;
621                            }
622    
623                            if (section_list_set_article_visible(p_section[i], p_article->aid, 0) != BBS_article_limit_per_section / group_count)
624                            {
625                                    printf("section_list_set_article_visible(aid = %d) error\n", p_article->aid);
626                            }
627                    }
628            }
629    
630            for (i = 0; i < section_count / 2; i++)
631            {
632                    section_first_aid = p_section[i]->p_article_head->aid;
633    
634                    for (j = 0; j < group_count; j++)
635                    {
636                            affected_count = section_list_move_topic(p_section[i], p_section[section_count / 2 + i], section_first_aid + j);
637    
638                            if (affected_count < 0)
639                            {
640                                    printf("move topic (aid = %d) error from section %d to section %d\n", section_first_aid + j, i, section_count / 2 + i);
641                                    break;
642                            }
643    
644                            if (affected_count != BBS_article_limit_per_section / group_count)
645                            {
646                                    printf("move topic (aid = %d) affected article count %d != %d\n",
647                                               section_first_aid + j, affected_count,
648                                               BBS_article_limit_per_section / group_count);
649                                    // break;
650                            }
651                    }
652            }
653    
654            for (i = 0; i < section_count; i++)
655            {
656                    if (p_section[i]->topic_count != (i < section_count / 2 ? 0 : group_count))
657                    {
658                            printf("Topic count error in section %d, %d != %d\n", i,
659                                       p_section[i]->topic_count, (i < section_count / 2 ? 0 : group_count));
660                            break;
661                    }
662    
663                    if (p_section[i]->visible_topic_count != (i < section_count / 2 ? 0 : group_count / 2))
664                    {
665                            printf("Visible topic count error in section %d, %d != %d\n", i,
666                                       p_section[i]->visible_topic_count, (i < section_count / 2 ? 0 : group_count / 2));
667                            break;
668                    }
669    
670                    if (p_section[i]->article_count != (i < section_count / 2 ? 0 : BBS_article_limit_per_section))
671                    {
672                            printf("Article count error in section %d, %d != %d\n", i,
673                                       p_section[i]->article_count, (i < section_count / 2 ? 0 : BBS_article_limit_per_section));
674                            break;
675                    }
676    
677                    if (p_section[i]->visible_article_count != (i < section_count / 2 ? 0 : BBS_article_limit_per_section / 2))
678                    {
679                            printf("Visible article count error in section %d, %d != %d\n", i,
680                                       p_section[i]->visible_article_count, (i < section_count / 2 ? 0 : BBS_article_limit_per_section / 2));
681                            break;
682                    }
683    
684                    if (p_section[i]->page_count != (i < section_count / 2 ? 0 : BBS_article_limit_per_section / 2 / BBS_article_limit_per_page))
685                    {
686                            printf("Page count error in section %d, %d != %d\n", i,
687                                       p_section[i]->page_count, (i < section_count / 2 ? 0 : BBS_article_limit_per_section / 2 / BBS_article_limit_per_page));
688                            break;
689                    }
690            }
691    
692            printf("Press ENTER to exit...");
693            getchar();
694    
695            article_block_cleanup();
696            section_list_pool_cleanup();
697    
698            if (unlink(ARTICLE_BLOCK_SHM_FILE) < 0)
699            {
700                    log_error("unlink(%s) error\n", ARTICLE_BLOCK_SHM_FILE);
701                    return -1;
702            }
703    
704            if (unlink(SECTION_LIST_SHM_FILE) < 0)
705            {
706                    log_error("unlink(%s) error\n", SECTION_LIST_SHM_FILE);
707                    return -1;
708            }
709    
710          log_end();          log_end();
711    


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

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