From 5e0e42baaf10cc86ed5c7b9171e11a76017af64f Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 26 Mar 2013 12:35:35 +0100 Subject: [PATCH] Make VIO_METHOD_HAS_FUNC macro more robust. --- src/vio/csync_vio_method.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vio/csync_vio_method.h b/src/vio/csync_vio_method.h index 84bba5334..243beaafa 100644 --- a/src/vio/csync_vio_method.h +++ b/src/vio/csync_vio_method.h @@ -30,8 +30,8 @@ #include "vio/csync_vio_handle.h" #define VIO_METHOD_HAS_FUNC(method,func) \ - (((size_t)(((char *)&((method)->func)) - ((char *)(method))) < (method)->method_table_size) \ - && method->func != NULL) + (method != NULL && method->func != NULL \ + && ((size_t)(((char *)&((method)->func)) - ((char *)(method))) < (method)->method_table_size)) typedef struct csync_vio_method_s csync_vio_method_t;