]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
pem: fix -Wunused-but-set-variable
authorSam James <sam@gentoo.org>
Wed, 19 Oct 2022 22:58:39 +0000 (23:58 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 21 Oct 2022 13:56:32 +0000 (15:56 +0200)
The loop never uses the value of 'line'.

Fixes this error with Clang 15:
```
crypto/pem/pem_lib.c:821:14: error: variable 'line' set but not used [-Werror,-Wunused-but-set-variable]
    int len, line, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
             ^
1 error generated.
```

Signed-off-by: Sam James <sam@gentoo.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19450)

crypto/pem/pem_lib.c

index 4c6b94da6b0dc258ec8ee7b21cc72f7969d54add..4035ac64e67e0b9a1ffa3eabbf84981029365583 100644 (file)
@@ -818,7 +818,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
 {
     BIO *tmp = *header;
     char *linebuf, *p;
-    int len, line, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
+    int len, ret = 0, end = 0, prev_partial_line_read = 0, partial_line_read = 0;
     /* 0 if not seen (yet), 1 if reading header, 2 if finished header */
     enum header_status got_header = MAYBE_HEADER;
     unsigned int flags_mask;
@@ -830,7 +830,7 @@ static int get_header_and_data(BIO *bp, BIO **header, BIO **data, char *name,
     if (linebuf == NULL)
         return 0;
 
-    for (line = 0; ; line++) {
+    while(1) {
         flags_mask = ~0u;
         len = BIO_gets(bp, linebuf, LINESIZE);
         if (len <= 0) {