/[LeafOK_CVS]/lbbs/include/article_favor.h
ViewVC logotype

Annotation of /lbbs/include/article_favor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Wed Oct 15 02:25:13 2025 UTC (5 months ago) by sysadm
Branch: MAIN
Changes since 1.1: +2 -1 lines
Content type: text/x-chdr
Use stack allocated variables instead of malloc

1 sysadm 1.1 /***************************************************************************
2     article_favor.h - description
3     -------------------
4     Copyright : (C) 2004-2025 by Leaflet
5     Email : leaflet@leafok.com
6     ***************************************************************************/
7    
8     /***************************************************************************
9     * *
10     * This program is free software; you can redistribute it and/or modify *
11     * it under the terms of the GNU General Public License as published by *
12     * the Free Software Foundation; either version 3 of the License, or *
13     * (at your option) any later version. *
14     * *
15     ***************************************************************************/
16    
17     #ifndef _ARTICLE_FAVOR_H_
18     #define _ARTICLE_FAVOR_H_
19    
20     #include "section_list.h"
21     #include <stdint.h>
22    
23 sysadm 1.2 #define MAX_FAVOR_AID_BASE_CNT 10000
24 sysadm 1.1 #define MAX_FAVOR_AID_INC_CNT 1000
25    
26     struct article_favor_t
27     {
28     int uid;
29 sysadm 1.2 int32_t aid_base[MAX_FAVOR_AID_BASE_CNT];
30 sysadm 1.1 int aid_base_cnt;
31     int32_t aid_inc[MAX_FAVOR_AID_INC_CNT];
32     int aid_inc_cnt;
33     };
34     typedef struct article_favor_t ARTICLE_FAVOR;
35    
36     extern ARTICLE_FAVOR BBS_article_favor;
37    
38     // Load baseline article favorite from DB
39     extern int article_favor_load(int uid, ARTICLE_FAVOR *p_favor, int keep_inc);
40     // Clear data
41     extern int article_favor_unload(ARTICLE_FAVOR *p_favor);
42     // Save incremental article favorite to DB
43     extern int article_favor_save_inc(const ARTICLE_FAVOR *p_favor);
44     // Merge incremental article favorite to baseline, without DB read / write
45     extern int article_favor_merge_inc(ARTICLE_FAVOR *p_favor);
46    
47     // Check if specific article was set as favorite
48     extern int article_favor_check(int32_t aid, const ARTICLE_FAVOR *p_favor);
49     // Set specific article as favorite
50     extern int article_favor_set(int32_t aid, ARTICLE_FAVOR *p_favor, int state);
51    
52     extern int query_favor_articles(ARTICLE_FAVOR *p_favor, int page_id, ARTICLE **p_articles,
53     char p_snames[][BBS_section_name_max_len + 1], int *p_article_count, int *p_page_count);
54    
55     #endif //_ARTICLE_FAVOR_H_

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