In add_to_iob(), limit the scope of the variable 'want' and turn an interestingly...
authorFabian Keil <fk@fabiankeil.de>
Sun, 13 Jun 2010 12:25:33 +0000 (12:25 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 13 Jun 2010 12:25:33 +0000 (12:25 +0000)
parsers.c

index c24b518..2f6f765 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.210 2009/12/25 11:39:26 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.211 2010/05/01 18:20:50 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -318,7 +318,7 @@ long flush_socket(jb_socket fd, struct iob *iob)
 jb_err add_to_iob(struct client_state *csp, char *buf, long n)
 {
    struct iob *iob = csp->iob;
-   size_t used, offset, need, want;
+   size_t used, offset, need;
    char *p;
 
    if (n <= 0) return JB_ERR_OK;
@@ -341,7 +341,12 @@ jb_err add_to_iob(struct client_state *csp, char *buf, long n)
 
    if (need > iob->size)
    {
-      for (want = csp->iob->size ? csp->iob->size : 512; want <= need;) want *= 2;
+      size_t want = csp->iob->size ? csp->iob->size : 512;
+
+      while (want <= need)
+      {
+         want *= 2;
+      }
       
       if (want <= csp->config->buffer_limit && NULL != (p = (char *)realloc(iob->buf, want)))
       {