X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fafb-req-itf.h;h=82372d1740076189ad9082f1a0908b564f635d51;hb=2a6a6609d2617cda251b55b5c2fdafd8b19ca279;hp=740b3ac0554a4cc35622e4dfb51aa70d5135dab6;hpb=1d0f869ce3379089b4f4c5285e3d30e971e5b93d;p=src%2Fapp-framework-binder.git diff --git a/include/afb/afb-req-itf.h b/include/afb/afb-req-itf.h index 740b3ac0..82372d17 100644 --- a/include/afb/afb-req-itf.h +++ b/include/afb/afb-req-itf.h @@ -46,7 +46,7 @@ struct afb_arg { * It records the functions to be called for the request. * Don't use this structure directly. * Use the helper functions documented below. - */ + */ struct afb_req_itf { /* CAUTION: respect the order, add at the end */ @@ -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'. @@ -300,7 +310,7 @@ static inline int afb_req_session_set_LOA(struct afb_req req, unsigned level) */ static inline struct afb_req *afb_req_store(struct afb_req req) { - struct afb_req *result = malloc(sizeof *result); + struct afb_req *result = (struct afb_req*)malloc(sizeof *result); if (result != NULL) { *result = req; afb_req_addref(req);