Francois Gouget : user32/tests: Avoid a couple of unneeded strlen() calls.

Alexandre Julliard julliard at winehq.org
Mon Dec 9 16:57:37 CST 2019


Module: wine
Branch: master
Commit: 6ccd78e35f1452276155f26e7f3756a8e08007d4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6ccd78e35f1452276155f26e7f3756a8e08007d4

Author: Francois Gouget <fgouget at free.fr>
Date:   Mon Dec  9 09:41:53 2019 +0100

user32/tests: Avoid a couple of unneeded strlen() calls.

Note that DeviceString is an array field and thus cannot be NULL.

Signed-off-by: Francois Gouget <fgouget at free.fr>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/monitor.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 567870e3d1..47e01b1a6a 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -71,7 +71,6 @@ static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *de
     int device_id;
     int subsys_id;
     int revision_id;
-    size_t length;
     HDC hdc;
 
     adapter_count++;
@@ -87,9 +86,8 @@ static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *de
        "#%d: wrong DeviceKey %s\n", index, device->DeviceKey);
 
     /* DeviceString */
-    length = strlen(device->DeviceString);
-    ok(broken(length == 0) || /* XP on Testbot will return an empty string, whereas XP on real machine doesn't. Probably a bug in virtual adapter driver */
-       length > 0, "#%d: expect DeviceString not empty\n", index);
+    ok(broken(!*device->DeviceString) || /* XP on Testbot will return an empty string, whereas XP on real machine doesn't. Probably a bug in virtual adapter driver */
+       *device->DeviceString, "#%d: expect DeviceString not empty\n", index);
 
     /* StateFlags */
     if (index == 0)
@@ -139,7 +137,7 @@ static void test_enumdisplaydevices_monitor(int adapter_index, int monitor_index
     ok(!strcmp(monitor_name, device->DeviceName), "#%d: expect %s, got %s\n", monitor_index, monitor_name, device->DeviceName);
 
     /* DeviceString */
-    ok(strlen(device->DeviceString) > 0, "#%d: expect DeviceString not empty\n", monitor_index);
+    ok(*device->DeviceString, "#%d: expect DeviceString not empty\n", monitor_index);
 
     /* StateFlags */
     if (adapter_index == 0 && monitor_index == 0)




More information about the wine-cvs mailing list