Avoid casting pointer to unsigned long long for NULL check
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 17 Jun 2015 01:20:29 +0000 (13:20 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 Jun 2015 04:04:10 +0000 (06:04 +0200)
This allows compilation on i386 with -WError. Otherwise we see
this:

  ../source4/torture/smb2/durable_open.c:41:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       __location__, #v, (unsigned long long)v, (unsigned long long)correct); \

because the pointer is 32 bits, while long long is 64.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/smb2/durable_open.c

index c3d63d19a032b9af10000ba39c526b16248f4408..412455c1d602924a9aa7f987b1c0acf8d715141e 100644 (file)
                ret = false; \
        }} while (0)
 
+#define CHECK_NOT_NULL(p) do { \
+       if ((p) == NULL) { \
+               torture_result(tctx, TORTURE_FAIL, "(%s): %s is NULL but it should not be.\n", \
+                               __location__, #p); \
+               ret = false; \
+       }} while (0)
+
 #define CHECK_STATUS(status, correct) do { \
        if (!NT_STATUS_EQUAL(status, correct)) { \
                torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
@@ -2267,7 +2274,7 @@ static bool test_durable_open_alloc_size(struct torture_context *tctx,
 
        /* prepare buffer */
        b = talloc_zero_size(mem_ctx, alloc_size_step);
-       CHECK_NOT_VAL(b, NULL);
+       CHECK_NOT_NULL(b);
 
        previous_session_id = smb2cli_session_current_id(tree->session->smbXcli);