blob: aa9abe7121cdef8257dd2ff6c9233dd3260cb4ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* $Id$ */
#include "bbs.h"
#ifdef ASSESS
/* do (*num) + n, n is integer. */
inline static void inc(unsigned char *num, int n)
{
if (n >= 0 && UCHAR_MAX - *num <= n)
(*num) = UCHAR_MAX;
else if (n < 0 && *num < -n)
(*num) = 0;
else
(*num) += n;
}
#define modify_column(_attr) \
int inc_##_attr(const char *userid, int num) \
{ \
userec_t xuser; \
int uid = getuser(userid, &xuser);\
if( uid > 0 ){ \
inc(&xuser._attr, num); \
passwd_sync_update(uid, &xuser); \
return xuser._attr; }\
return 0;\
}
modify_column(badpost); /* inc_badpost */
#endif // ASSESS
|