diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-02 17:27:26 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-02 17:27:26 +0800 |
commit | 0bc094e344f98f43685082c9e3ab1271537c71f5 (patch) | |
tree | 2826d58b5f5982922eb9a540be5259f41fade0dd | |
parent | c622faa90d697f8794f7a2b9ee4d3390ce7dbe0e (diff) | |
download | pttbbs-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.c | 46 |
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) { |