Skip to content

Commit

Permalink
pem: fix -Wunused-but-set-variable
Browse files Browse the repository at this point in the history
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 #19450)
  • Loading branch information
thesamesam authored and t8m committed Oct 21, 2022
1 parent 75ecda9 commit 71bc497
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/pem/pem_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 71bc497

Please sign in to comment.