Huw Davies : gdi32/tests: Combine the matching macros into a single function.

Alexandre Julliard julliard at winehq.org
Fri Mar 17 15:19:46 CDT 2017


Module: wine
Branch: master
Commit: 858c07f667b9211459ef6eace8efffcd006d9609
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=858c07f667b9211459ef6eace8efffcd006d9609

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Mar 17 08:44:33 2017 +0000

gdi32/tests: Combine the matching macros into a single function.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/tests/font.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 7c80779..fb27f8e 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -30,10 +30,12 @@
 
 #include "wine/test.h"
 
-/* Do not allow more than 1 deviation here */
-#define match_off_by_1(a, b, exact) (abs((a) - (b)) <= ((exact) ? 0 : 1))
-
-#define near_match(a, b) (abs((a) - (b)) <= 6)
+static inline BOOL match_off_by_n(int a, int b, unsigned int n)
+{
+    return abs(a - b) <= n;
+}
+#define match_off_by_1(a, b, exact) match_off_by_n((a), (b), (exact) ? 0 : 1)
+#define near_match(a, b) match_off_by_n((a), (b), 6)
 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 
 static LONG  (WINAPI *pGdiGetCharDimensions)(HDC hdc, LPTEXTMETRICW lptm, LONG *height);




More information about the wine-cvs mailing list