Am 27.03.23 um 13:49 schrieb selva.n...@gmail.com:
From: Selva Nair <selva.n...@gmail.com>

- Do not use non-literal initializers for static objects
- Replace empty initializer {} by {0}

Should we go to a revision, I would suggest to not make something
compliant to a compiler because that is assigning it way too much power
and control. A terms such as "ready to be compiled with MSVC" or so
would be in order, or making this code compliant with some wisely chosen
version of the ISO 9899 standard, aka. standard C.

Signed-off-by: Selva Nair <selva.n...@gmail.com>
---
To be applied after the test-pkcs11 patch set

  tests/unit_tests/openvpn/cert_data.h      |  6 ++---
  tests/unit_tests/openvpn/test_cryptoapi.c | 24 ++++++++++++++------
  tests/unit_tests/openvpn/test_pkcs11.c    | 27 ++++++++++++++++-------
  3 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/tests/unit_tests/openvpn/cert_data.h 
b/tests/unit_tests/openvpn/cert_data.h
index 33de35ec..0886b071 100644
--- a/tests/unit_tests/openvpn/cert_data.h
+++ b/tests/unit_tests/openvpn/cert_data.h
@@ -79,7 +79,7 @@ static const char *const cert2 =
      "HeTsAlHjfFEReVDiNCI9vMQLKFKKWnAorT2+iyRueA3bt2gchf863BBhZvJddL7Q\n"
      "KBa0osXw+eGBRAwsm7m1qCho3b3fN2nFAa+k07ptRkOeablmFdXE81nVlA==\n"
      "-----END CERTIFICATE-----\n";
-static const char *const key2 = key1;
+#define key2 key1

So we are not getting rid of #defines yet? Can't we make this data
somehow local?  Personally, I would probably - at least outside unit
tests - write (key1) instead of bare key, so that it's clear this is one
name and can't be somehow extended.

Whenever I see such code I wonder if it's not worthwhile to slowly walk
towards C++17 where appropriate.

I am not going to NAK or ACK this because I won't have time available to
set up a compilation environment based on Frank's repo within the next
three days, just commenting.


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to