[PATCH] crypt32/tests: Avoid an unneeded strlen() call.

Francois Gouget fgouget at free.fr
Tue Oct 23 08:46:14 CDT 2018


Signed-off-by: Francois Gouget <fgouget at free.fr>
---

As in the previous patch, it seems wasteful to compute the length of the 
string when all we care about is the first character. Plus the 'if 
(*str)' pattern is pretty common and used extensively in Wine already.

Also here there is obviously no issue with the pointer being NULL.

 dlls/crypt32/tests/encode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c
index 4a6626ab006..64a45cdbbf8 100644
--- a/dlls/crypt32/tests/encode.c
+++ b/dlls/crypt32/tests/encode.c
@@ -1017,7 +1017,7 @@ static void compareNameValues(const CERT_NAME_VALUE *expected,
 static void compareRDNAttrs(const CERT_RDN_ATTR *expected,
  const CERT_RDN_ATTR *got)
 {
-    if (expected->pszObjId && strlen(expected->pszObjId))
+    if (expected->pszObjId && *expected->pszObjId)
     {
         ok(got->pszObjId != NULL, "Expected OID %s, got NULL\n",
          expected->pszObjId);
-- 
2.19.1




More information about the wine-devel mailing list