Explorar o código

* Use ContextNote for debug buffer appending

Bryan Drewery %!s(int64=16) %!d(string=hai) anos
pai
achega
2d787d117f
Modificáronse 6 ficheiros con 12 adicións e 14 borrados
  1. 1 1
      src/binds.c
  2. 6 2
      src/debug.h
  3. 2 4
      src/egg_timer.c
  4. 1 2
      src/mod/irc.mod/irc.c
  5. 1 4
      src/net.c
  6. 1 1
      src/userent.c

+ 1 - 1
src/binds.c

@@ -275,7 +275,7 @@ static int bind_entry_exec(bind_table_t *table, bind_entry_t *entry, void **al)
 	bind_entry_t *prev = NULL;
 	int retval;
 
-	ContextNote(entry->mask);
+	ContextNote("bind", entry->mask);
 	/* Give this entry a hit. */
 	entry->nhits++;
 

+ 6 - 2
src/debug.h

@@ -13,11 +13,15 @@
   get_buf_inc(); \
 } while (0)
 
+#define ContextNote(from, buf) do { \
+  simple_snprintf(get_buf[current_get_buf], sizeof(get_buf[current_get_buf]), "%s: %s", from, buf); \
+  get_buf_inc(); \
+} while(0)
+
+
 /*
  *    Handy aliases for memory tracking and core dumps
  */
-#  define ContextNote(note)     {}
-
 #define debug0(x)               putlog(LOG_DEBUG,"*",x)
 #define debug1(x,a1)            putlog(LOG_DEBUG,"*",x,a1)
 #define debug2(x,a1,a2)         putlog(LOG_DEBUG,"*",x,a1,a2)

+ 2 - 4
src/egg_timer.c

@@ -253,10 +253,8 @@ static bool process_timer(egg_timer_t* timer) {
 		deleted = 1;
 	}
 
-	if (timer->name) {
-		simple_snprintf(get_buf[current_get_buf], sizeof(get_buf[current_get_buf]), "Execing timer: %s", timer->name);
-		get_buf_inc();
-	}
+	if (timer->name)
+		ContextNote("Timer", timer->name);
 
 	callback(client_data);
 	return deleted;

+ 1 - 2
src/mod/irc.mod/irc.c

@@ -1684,8 +1684,7 @@ flush_modes()
 
   memberlist *m = NULL;
 
-  strlcpy(get_buf[current_get_buf], "Idle", sizeof(get_buf[current_get_buf]));
-  get_buf_inc();
+  Context;
 
   for (register struct chanset_t *chan = chanset; chan; chan = chan->next) {
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {

+ 1 - 4
src/net.c

@@ -1481,15 +1481,12 @@ bool socket_run() {
 
   int xx = sockgets(buf, &i);
 
-  get_buf[current_get_buf][0] = 0;
-
   if (xx >= 0) {		/* Non-error */
     if ((idx = findanyidx(xx)) != -1) {
       if (likely(dcc[idx].type->activity)) {
         /* Traffic stats */
         if (dcc[idx].type->name) {
-          simple_snprintf(get_buf[current_get_buf], sizeof(get_buf[current_get_buf]), "%s: %s", dcc[idx].type->name, buf);
-          get_buf_inc();
+          ContextNote(dcc[idx].type->name, buf);
 
           if (!strncmp(dcc[idx].type->name, "BOT", 3))
             traffic.in_today.bn += i + 1;

+ 1 - 1
src/userent.c

@@ -845,7 +845,7 @@ static bool botaddr_set(struct userrec *u, struct user_entry *e, void *buf)
       free(bi->uplink);
       free(bi);
     }
-    ContextNote("(sharebug) occurred in botaddr_set");
+    ContextNote("botaddr_set", "(sharebug) occurred in botaddr_set");
     bi = (struct bot_addr *) buf;
     e->u.extra = (struct bot_addr *) buf;
   }