From 69162a9bf492fea52021e0b8d93454bbf496dedc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Mon, 8 Aug 2016 13:57:21 +0200 Subject: [PATCH 1/1] add validity functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I56f4f6aebe673363c8b07c55f68ebbb1362b04fc Signed-off-by: José Bollo --- include/afb/afb-event-itf.h | 10 ++++++++++ include/afb/afb-req-itf.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/afb/afb-event-itf.h b/include/afb/afb-event-itf.h index e31f22c1..5f7b8370 100644 --- a/include/afb/afb-event-itf.h +++ b/include/afb/afb-event-itf.h @@ -42,6 +42,16 @@ struct afb_event { void *closure; /* the closure argument for functions of 'itf' */ }; +/* + * Checks wether the 'event' is valid or not. + * + * Returns 0 if not valid or 1 if valid. + */ +static inline int afb_event_is_valid(struct afb_event event) +{ + return event.itf != NULL; +} + /* * Broadcasts widely the 'event' with the data 'object'. * 'object' can be NULL. diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h index bc4b618c..153887b0 100644 --- a/include/afb/afb-req-itf.h +++ b/include/afb/afb-req-itf.h @@ -82,6 +82,16 @@ struct afb_req { void *closure; /* the closure argument for functions of 'itf' */ }; +/* + * Checks wether the request 'req' is valid or not. + * + * Returns 0 if not valid or 1 if valid. + */ +static inline int afb_req_is_valid(struct afb_req req) +{ + return req.itf != NULL; +} + /* * Gets from the request 'req' the argument of 'name'. * Returns a PLAIN structure of type 'struct afb_arg'. -- 2.16.6