]> git.ozlabs.org Git - ccan/commitdiff
antithread: avoid arithmetic on void pointers
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 22 Mar 2011 01:50:49 +0000 (12:20 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 22 Mar 2011 01:50:49 +0000 (12:20 +1030)
ccan/antithread/antithread.c
ccan/failtest/failtest.c

index 61b288a36bc11c61a6853d076b4f1b5d06c3f95f..da607c1e7b28cd15a07bad97c95805349c863a65 100644 (file)
@@ -193,7 +193,7 @@ struct at_pool *at_pool(unsigned long size)
 
        /* Then we remap into the middle of it. */
        munmap(p->pool, size+PADDING);
-       p->pool = mmap(p->pool + PADDING/2, size, PROT_READ|PROT_WRITE,
+       p->pool = mmap((char *)p->pool + PADDING/2, size, PROT_READ|PROT_WRITE,
                       MAP_SHARED, fd, 0);
        if (p->pool == MAP_FAILED)
                goto fail_free;
index 334295ad158ed8a8852c5bfe7487b7db0666e303..0f2ab0c7f2cda15464d0ee7dc81b16d34e25b602 100644 (file)
@@ -84,8 +84,9 @@ static struct failtest_call *add_history_(enum failtest_call_type type,
 #define add_history(type, file, line, elem) \
        add_history_((type), (file), (line), (elem), sizeof(*(elem)))
 
+/* We do a fake call inside a sizeof(), to check types. */
 #define set_cleanup(call, clean, type)                 \
-       (call)->cleanup = (void *)((void)sizeof(clean((type *)NULL)), (clean))
+       (call)->cleanup = (void *)((void)sizeof(clean((type *)NULL),1), (clean))
 
 static bool read_write_info(int fd)
 {