summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-02 17:27:26 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-02 17:27:26 +0800
commit0bc094e344f98f43685082c9e3ab1271537c71f5 (patch)
tree2826d58b5f5982922eb9a540be5259f41fade0dd
parentc622faa90d697f8794f7a2b9ee4d3390ce7dbe0e (diff)
downloadpttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar.gz
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar.bz2
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar.lz
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar.xz
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.tar.zst
pttbbs-0bc094e344f98f43685082c9e3ab1271537c71f5.zip
fix my wrong usage @@
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1389 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/assess.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index 95426e26..a9bbe10f 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -13,41 +13,23 @@ inline static void inc(unsigned char *num, int n)
(*num) += n;
}
-int inc_goodpost(int uid, int num)
-{
- passwd_query(uid, &xuser);
- inc(&xuser.goodpost, num);
- SHM->uinfo[uid - 1].goodpost = xuser.goodpost;
- passwd_update(uid, &xuser);
- return xuser.goodpost;
-}
-
-int inc_badpost(int uid, int num)
-{
- passwd_query(uid, &xuser);
- inc(&xuser.badpost, num);
- SHM->uinfo[uid - 1].badpost = xuser.badpost;
- passwd_update(uid, &xuser);
- return xuser.badpost;
+#define modify_column(name) \
+int inc_##name(int uid, int num) \
+{ \
+ passwd_query(uid, &xuser); \
+ inc(&xuser.name, num); \
+ userinfo_t *user = search_ulist(uid); \
+ if (user != NULL) \
+ user->name = xuser.name; \
+ passwd_update(uid, &xuser); \
+ return xuser.name; \
}
-int inc_goodsale(int uid, int num)
-{
- passwd_query(uid, &xuser);
- inc(&xuser.goodsale, num);
- SHM->uinfo[uid - 1].goodsale = xuser.goodsale;
- passwd_update(uid, &xuser);
- return xuser.goodsale;
-}
+modify_column(goodpost);
+modify_column(badpost);
+modify_column(goodsale);
+modify_column(badsale);
-int inc_badsale(int uid, int num)
-{
- passwd_query(uid, &xuser);
- inc(&xuser.badsale, num);
- SHM->uinfo[uid - 1].badsale = xuser.badsale;
- passwd_update(uid, &xuser);
- return xuser.badsale;
-}
void set_assess(int uid, unsigned char num, int type)
{