[git] GPG-ERROR - branch, master, updated. libgpg-error-1.23-2-g0982a72

by Werner Koch cvs at cvs.gnupg.org
Fri Jun 24 20:51:13 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".

The branch, master has been updated
       via  0982a72ecc8e7738ec968b3a6710bdacb0f2da4e (commit)
      from  32d671c87db54e397e75309fc9215d84d1107c0d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0982a72ecc8e7738ec968b3a6710bdacb0f2da4e
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Jun 24 20:49:23 2016 +0200

    estream: Remove two compiler warning.
    
    * src/estream.c (func_file_create): Remove dead assignment.
    (doreadline): Do not decrement SPACE_LEFT before breaking the loop.
    Add an extra block to limit the scope of that variable.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/estream.c b/src/estream.c
index e382a29..b4d1c74 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -1611,7 +1611,6 @@ func_file_create (void **cookie, int *filedes,
   int fd;
 
   err = 0;
-  fd = -1;
 
   file_cookie = mem_alloc (sizeof (*file_cookie));
   if (! file_cookie)
@@ -2769,7 +2768,6 @@ doreadline (estream_t _GPGRT__RESTRICT stream, size_t max_length,
             char *_GPGRT__RESTRICT *_GPGRT__RESTRICT line,
             size_t *_GPGRT__RESTRICT line_length)
 {
-  size_t space_left;
   size_t line_size;
   estream_t line_stream;
   char *line_new;
@@ -2798,46 +2796,49 @@ doreadline (estream_t _GPGRT__RESTRICT stream, size_t max_length,
   if (err)
     goto out;
 
-  space_left = max_length;
-  line_size = 0;
-  while (1)
-    {
-      if (max_length && (space_left == 1))
-	break;
+  {
+    size_t space_left = max_length;
 
-      err = es_peek (stream, &data, &data_len);
-      if (err || (! data_len))
-	break;
+    line_size = 0;
+    for (;;)
+      {
+        if (max_length && (space_left == 1))
+          break;
 
-      if (data_len > (space_left - 1))
-	data_len = space_left - 1;
+        err = es_peek (stream, &data, &data_len);
+        if (err || (! data_len))
+          break;
 
-      newline = memchr (data, '\n', data_len);
-      if (newline)
-	{
-	  data_len = (newline - (char *) data) + 1;
-	  err = _gpgrt_write (line_stream, data, data_len, NULL);
-	  if (! err)
-	    {
-	      space_left -= data_len;
-	      line_size += data_len;
-	      es_skip (stream, data_len);
-	      break;
-	    }
-	}
-      else
-	{
-	  err = _gpgrt_write (line_stream, data, data_len, NULL);
-	  if (! err)
-	    {
-	      space_left -= data_len;
-	      line_size += data_len;
-	      es_skip (stream, data_len);
-	    }
-	}
-      if (err)
-	break;
-    }
+        if (data_len > (space_left - 1))
+          data_len = space_left - 1;
+
+        newline = memchr (data, '\n', data_len);
+        if (newline)
+          {
+            data_len = (newline - (char *) data) + 1;
+            err = _gpgrt_write (line_stream, data, data_len, NULL);
+            if (! err)
+              {
+                /* Not needed: space_left -= data_len */
+                line_size += data_len;
+                es_skip (stream, data_len);
+                break; /* endless loop */
+              }
+          }
+        else
+          {
+            err = _gpgrt_write (line_stream, data, data_len, NULL);
+            if (! err)
+              {
+                space_left -= data_len;
+                line_size += data_len;
+                es_skip (stream, data_len);
+              }
+          }
+        if (err)
+          break;
+      }
+  }
   if (err)
     goto out;
 
@@ -4240,7 +4241,7 @@ _gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr,
    Returns the length of the line. EOF is indicated by a line of
    length zero. A truncated line is indicated my setting the value at
    MAX_LENGTH to 0.  If the returned value is less then 0 not enough
-   memory was enable or another error occurred; ERRNO is then set
+   memory was available or another error occurred; ERRNO is then set
    accordingly.
 
    If a line has been truncated, the file pointer is moved forward to

-----------------------------------------------------------------------

Summary of changes:
 src/estream.c | 81 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 41 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
Error codes used by GnuPG et al.
http://git.gnupg.org




More information about the Gnupg-commits mailing list