| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
user_list.c - description |
/* |
| 3 |
------------------- |
* user_stat |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - data model and basic operations of user related statistics |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#include "log.h" |
#include "log.h" |
| 10 |
#include "section_list.h" |
#include "section_list.h" |
| 67 |
break; |
break; |
| 68 |
} |
} |
| 69 |
|
|
| 70 |
|
if (p_article->visible == 0) |
| 71 |
|
{ |
| 72 |
|
continue; |
| 73 |
|
} |
| 74 |
|
|
| 75 |
if (p_article->uid > p_map->last_uid) |
if (p_article->uid > p_map->last_uid) |
| 76 |
{ |
{ |
| 77 |
#ifdef _DEBUG |
#ifdef _DEBUG |
| 78 |
log_error("uid=%d of article(aid=%d) is greater than last_uid=%d, waiting for next user list update\n", |
log_error("uid=%d of article(aid=%d) is greater than last_uid=%d\n", |
| 79 |
p_article->uid, p_article->aid, p_map->last_uid); |
p_article->uid, p_article->aid, p_map->last_uid); |
| 80 |
#endif |
#endif |
| 81 |
break; |
continue; |
| 82 |
} |
} |
| 83 |
|
|
| 84 |
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) |
| 113 |
mid = (left + right) / 2; |
mid = (left + right) / 2; |
| 114 |
if (uid < p_map->stat_list[mid].uid) |
if (uid < p_map->stat_list[mid].uid) |
| 115 |
{ |
{ |
| 116 |
right = mid; |
right = mid - 1; |
| 117 |
} |
} |
| 118 |
else if (uid > p_map->stat_list[mid].uid) |
else if (uid > p_map->stat_list[mid].uid) |
| 119 |
{ |
{ |
| 155 |
mid = (left + right) / 2; |
mid = (left + right) / 2; |
| 156 |
if (uid < p_map->stat_list[mid].uid) |
if (uid < p_map->stat_list[mid].uid) |
| 157 |
{ |
{ |
| 158 |
right = mid; |
right = mid - 1; |
| 159 |
} |
} |
| 160 |
else if (uid > p_map->stat_list[mid].uid) |
else if (uid > p_map->stat_list[mid].uid) |
| 161 |
{ |
{ |