From ae6cedfe56f56a4b805eb563e98f7420eb10487f Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 21 Jul 2005 19:03:34 +0000 Subject: Patch from Danny Kukawka : here the new patch with a macro instead of always the same codeblock in so many funtions. --- libhal/libhal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libhal/libhal.h') diff --git a/libhal/libhal.h b/libhal/libhal.h index 11e41bc2..c79f8ec2 100644 --- a/libhal/libhal.h +++ b/libhal/libhal.h @@ -35,6 +35,17 @@ extern "C" { #endif #endif +/** Checks if LibHalContext *ctx == NULL */ +#define LIBHAL_CHECK_LIBHALCONTEXT(_ctx_, _ret_) \ + do { \ + if (_ctx_ == NULL) { \ + fprintf (stderr, \ + "%s %d : LibHalContext *ctx is NULL\n", \ + __FILE__, __LINE__); \ + return _ret_; \ + } \ + } while(0) + /** * @addtogroup LibHal * -- cgit v1.2.3