obstack: fix compiler warning
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 19 Jun 2019 21:05:59 +0000 (14:05 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jun 2019 21:03:05 +0000 (14:03 -0700)
MS Visual C suggests that the construct

condition ? (int) i : (ptrdiff_t) d

is incorrect. Let's fix this by casting to ptrdiff_t also for the
positive arm of the conditional.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/obstack.h
index ced94d01180a66b2f2d471c1ebaef4eec07e6c49..ae36ed6a669d96266f01f4983b9d6a418e1dcfef 100644 (file)
@@ -496,7 +496,7 @@ __extension__                                                               \
 ( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk,            \
   ((((h)->temp.tempint > 0                                             \
     && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk))    \
-   ? (int) ((h)->next_free = (h)->object_base                          \
+   ? (ptrdiff_t) ((h)->next_free = (h)->object_base                            \
            = (h)->temp.tempint + (char *) (h)->chunk)                  \
    : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))