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

Diff of /lbbs/src/user_stat.c

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

Revision 1.5 by sysadm, Tue Nov 4 14:58:56 2025 UTC Revision 1.8 by sysadm, Fri Dec 19 06:16:27 2025 UTC
# Line 6  Line 6 
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9    #ifdef HAVE_CONFIG_H
10    #include "config.h"
11    #endif
12    
13  #include "log.h"  #include "log.h"
14  #include "section_list.h"  #include "section_list.h"
15  #include "user_list.h"  #include "user_list.h"
# Line 15  int user_stat_map_init(USER_STAT_MAP *p_ Line 19  int user_stat_map_init(USER_STAT_MAP *p_
19  {  {
20          if (p_map == NULL)          if (p_map == NULL)
21          {          {
22                  log_error("NULL pointer error\n");                  log_error("NULL pointer error");
23                  return -1;                  return -1;
24          }          }
25    
# Line 36  int user_stat_map_update(USER_STAT_MAP * Line 40  int user_stat_map_update(USER_STAT_MAP *
40    
41          if (p_map == NULL)          if (p_map == NULL)
42          {          {
43                  log_error("NULL pointer error\n");                  log_error("NULL pointer error");
44                  return -1;                  return -1;
45          }          }
46    
47          // Load uid_list          // Load uid_list
48          if (get_user_id_list(uid_list, &user_cnt, p_map->last_uid + 1) < 0)          if (get_user_id_list(uid_list, &user_cnt, p_map->last_uid + 1) < 0)
49          {          {
50                  log_error("get_user_id_list(%d, 0) error\n", user_cnt);                  log_error("get_user_id_list(%d, 0) error", user_cnt);
51                  return -2;                  return -2;
52          }          }
53    
# Line 63  int user_stat_map_update(USER_STAT_MAP * Line 67  int user_stat_map_update(USER_STAT_MAP *
67                  p_article = article_block_find_by_index(i);                  p_article = article_block_find_by_index(i);
68                  if (p_article == NULL)                  if (p_article == NULL)
69                  {                  {
70                          log_error("article_block_find_by_index(index=%d) error\n", i);                          log_error("article_block_find_by_index(index=%d) error", i);
71                          break;                          break;
72                  }                  }
73    
# Line 74  int user_stat_map_update(USER_STAT_MAP * Line 78  int user_stat_map_update(USER_STAT_MAP *
78    
79                  if (p_article->uid > p_map->last_uid)                  if (p_article->uid > p_map->last_uid)
80                  {                  {
81  #ifdef _DEBUG                          log_debug("uid=%d of article(aid=%d) is greater than last_uid=%d",
                         log_error("uid=%d of article(aid=%d) is greater than last_uid=%d\n",  
82                                            p_article->uid, p_article->aid, p_map->last_uid);                                            p_article->uid, p_article->aid, p_map->last_uid);
 #endif  
83                          continue;                          continue;
84                  }                  }
85    
86                  if (user_stat_article_cnt_inc(p_map, p_article->uid, 1) < 0)                  if (user_stat_article_cnt_inc(p_map, p_article->uid, 1) < 0)
87                  {                  {
88                          log_error("user_stat_article_cnt_inc(uid=%d, 1) error\n", p_article->uid);                          log_error("user_stat_article_cnt_inc(uid=%d, 1) error", p_article->uid);
89                          break;                          break;
90                  }                  }
91          }          }
# Line 101  int user_stat_article_cnt_inc(USER_STAT_ Line 103  int user_stat_article_cnt_inc(USER_STAT_
103    
104          if (p_map == NULL)          if (p_map == NULL)
105          {          {
106                  log_error("NULL pointer error\n");                  log_error("NULL pointer error");
107                  return -1;                  return -1;
108          }          }
109    
# Line 143  int user_stat_get(USER_STAT_MAP *p_map, Line 145  int user_stat_get(USER_STAT_MAP *p_map,
145    
146          if (p_map == NULL)          if (p_map == NULL)
147          {          {
148                  log_error("NULL pointer error\n");                  log_error("NULL pointer error");
149                  return -1;                  return -1;
150          }          }
151    


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

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