Make the number of targets tracked for target change a #define.

This commit is contained in:
Jilles Tjoelker 2010-02-13 15:18:17 +01:00
parent 97deedc42f
commit ad1d39a76f
2 changed files with 7 additions and 5 deletions

View file

@ -53,6 +53,8 @@ struct Blacklist;
#define IDLEN 10
#define TGCHANGE_NUM 10 /* how many targets we keep track of */
/*
* pre declare structs
*/
@ -255,7 +257,7 @@ struct LocalUser
struct AuthRequest *auth_request;
/* target change stuff */
uint32_t targets[10]; /* targets were aware of (fnv32(use_id(target_p))) */
uint32_t targets[TGCHANGE_NUM]; /* targets were aware of (fnv32(use_id(target_p))) */
unsigned int targinfo[2]; /* cyclic array, no in use */
time_t target_last; /* last time we cleared a slot */

View file

@ -642,9 +642,9 @@ msg_channel_flags(int p_or_n, const char *command, struct Client *client_p,
command, c, chptr->chname, text);
}
#define PREV_FREE_TARGET(x) ((FREE_TARGET(x) == 0) ? 9 : FREE_TARGET(x) - 1)
#define PREV_TARGET(i) ((i == 0) ? i = 9 : --i)
#define NEXT_TARGET(i) ((i == 9) ? i = 0 : ++i)
#define PREV_FREE_TARGET(x) ((FREE_TARGET(x) == 0) ? TGCHANGE_NUM - 1 : FREE_TARGET(x) - 1)
#define PREV_TARGET(i) ((i == 0) ? i = TGCHANGE_NUM - 1 : --i)
#define NEXT_TARGET(i) ((i == TGCHANGE_NUM - 1) ? i = 0 : ++i)
static void
expire_tgchange(void *unused)
@ -715,7 +715,7 @@ add_target(struct Client *source_p, struct Client *target_p)
source_p->localClient->target_last = rb_current_time();
}
/* cant clear any, full target list */
else if(USED_TARGETS(source_p) == 10)
else if(USED_TARGETS(source_p) == TGCHANGE_NUM)
{
ServerStats.is_tgch++;
add_tgchange(source_p->sockhost);