]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
x509: fix -Wunused-but-set-variable
authorSam James <sam@gentoo.org>
Wed, 19 Oct 2022 23:14:53 +0000 (00:14 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 21 Oct 2022 13:56:32 +0000 (15:56 +0200)
The value of 'l' isn't ever actually used.

Fixes this error with Clang 15:
```
crypto/x509/x_name.c:506:9: error: variable 'l' set but not used [-Werror,-Wunused-but-set-variable]
    int l, i;
        ^
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/x509/x_name.c

index 98d03cf12010f33d657cd9a4efd3828ec2901e13..4568833f81b94876216681c4ba5d182a6f95c859 100644 (file)
@@ -503,9 +503,7 @@ int X509_NAME_set(X509_NAME **xn, const X509_NAME *name)
 int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
 {
     char *s, *c, *b;
-    int l, i;
-
-    l = 80 - 2 - obase;
+    int i;
 
     b = X509_NAME_oneline(name, NULL, 0);
     if (b == NULL)
@@ -531,12 +529,10 @@ int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
                 if (BIO_write(bp, ", ", 2) != 2)
                     goto err;
             }
-            l--;
         }
         if (*s == '\0')
             break;
         s++;
-        l--;
     }
 
     OPENSSL_free(b);