Hi, On Mon, Mar 27, 2023 at 9:59 AM Matthias Andree <matthias.and...@gmx.de> wrote:
> 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. > In this case "MSVC compliant" was arguably a poor choice of words as what the change does is to avoid non-C99 constructs. However it made sense to refer to MSVC in the context of what prompted this patch. That said, in a cross-platform code base one often has to make changes to please compilers just to get things to build. > 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. I was not getting rid of any defines -- just trying to avoid defines if it can be done without jumping through too many hoops. Right, (key1) would be better. Instead of making key2 local, we can write it out fully without referring to the fact that key1 = key2. The latter was anyway a lazy man's choice, not relevant for the working of the tests. If anyone feels strongly I can submit a v2 with key2, key4, and cname4 fully written out like: static const char *const key2 = "-----BEGIN PRIVATE KEY-----\n" ....... etc.. static const char *cname4 = "ovpn-test-rsa1"; That may also make maintaining this data easier -- ie., any cert/key pair could be replaced without affecting others. Selva
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel