Anonymous avatar Anonymous committed 8cd932e

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

Comments (0)

Files changed (2)

 
 #define IDLEN		10
 
+#define TGCHANGE_NUM	10	/* how many targets we keep track of */
+
 /*
  * pre declare structs
  */
 	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 */
 

modules/core/m_message.c

 			     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)
 			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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.