Explorar o código

* Port [3725] to 1.2.15
* Cleanup page code (addresses #208)


svn: 3726

Bryan Drewery %!s(int64=18) %!d(string=hai) anos
pai
achega
4f6aa461e7
Modificáronse 1 ficheiros con 9 adicións e 9 borrados
  1. 9 9
      src/dcc.c

+ 9 - 9
src/dcc.c

@@ -862,7 +862,8 @@ append_line(int idx, char *line)
       free(p->msg);
       free(p);
     }
-    c->buffer = 0;
+    c->buffer = NULL;
+    c->current_lines = 0;
     dcc[idx].status &= ~STAT_PAGE;
     do_boot(idx, conf.bot->nick, "too many pages - senq full");
     return;
@@ -871,14 +872,10 @@ append_line(int idx, char *line)
   size_t l = strlen(line);
 
   if ((c->line_count < c->max_line) && (c->buffer == NULL)) {
-    c->line_count++;
+    ++c->line_count;
     tputs(dcc[idx].sock, line, l);
   } else {
-    c->current_lines++;
-    if (c->buffer == NULL)
-      q = NULL;
-    else
-      for (q = c->buffer; q->next; q = q->next) ;
+    ++c->current_lines;
 
     p = (struct msgq *) my_calloc(1, sizeof(struct msgq));
 
@@ -886,10 +883,13 @@ append_line(int idx, char *line)
     p->msg = (char *) my_calloc(1, l + 1);
     p->next = NULL;
     strcpy(p->msg, line);
-    if (q == NULL)
+
+    if (c->buffer == NULL)
       c->buffer = p;
-    else
+    else {
+      for (q = c->buffer; q->next; q = q->next) ;
       q->next = p;
+    }
   }
 }