help-gsasl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fixup! use custom getline() implementation


From: Enrico Scholz
Subject: [PATCH] fixup! use custom getline() implementation
Date: Sat, 19 Nov 2011 11:13:20 +0100

contains:

- a whitespace cleanup
- a fix for accessing a correct pointer
- a fix for the queue cleanup optimization
- a fix for assert() condition which would triggered due to the previous
  change

Signed-off-by: Enrico Scholz <address@hidden>
---
 src/gsasl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gsasl.c b/src/gsasl.c
index 7dd2008..c479eed 100644
--- a/src/gsasl.c
+++ b/src/gsasl.c
@@ -325,7 +325,7 @@ static ssize_t streaminput_getline(char **lineptr, size_t 
*n,
   assert(b->r_pos <= b->w_pos);
   assert(b->w_pos <= array_size(b->buf));
 
-  while (p == NULL) 
+  while (p == NULL)
     {
       size_t           l = b->w_pos - b->r_pos;
       size_t           req_len;
@@ -351,7 +351,7 @@ static ssize_t streaminput_getline(char **lineptr, size_t 
*n,
       out_pos  += l;
       /* not really needed, but to avoid corrupt strings in error case,
         terminate string here */
-      lineptr[out_pos] = '\0';
+      (*lineptr)[out_pos] = '\0';
 
       assert(b->r_pos <= b->w_pos);
       if (b->r_pos == b->w_pos)
@@ -359,7 +359,7 @@ static ssize_t streaminput_getline(char **lineptr, size_t 
*n,
          /* nothing buffered; reset pointers */
          b->r_pos = b->w_pos = 0;
        }
-      else if (b->r_pos < array_size(b->buf) * 2 / 3)
+      else if (b->r_pos > array_size(b->buf) * 2 / 3)
        {
          /* buffered data starts in the last 2/3 of the buffer; move it to the
             front to make operations more efficiently */
@@ -368,7 +368,7 @@ static ssize_t streaminput_getline(char **lineptr, size_t 
*n,
          b->r_pos = 0;
        }
       assert(b->r_pos <= b->w_pos);
-      assert(b->w_pos < array_size(b->buf));
+      assert(b->w_pos <= array_size(b->buf));
 
       /* there was no \n in the data; we have to read new one from the input
         stream.  */
-- 
1.7.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]