afb-binding-v3: Fix issues in includes 69/19469/1
authorJosé Bollo <jose.bollo@iot.bzh>
Wed, 2 Jan 2019 19:01:44 +0000 (20:01 +0100)
committerJose Bollo <jose.bollo@iot.bzh>
Fri, 4 Jan 2019 13:19:06 +0000 (14:19 +0100)
Fix 1: afb_api_v3_verbose doesn't exist

Fix 2: afb_api_vverbose isn't declared

Fix 3: Ensure implicit cast of "api" and "req"

  Using presupposed knowledge of internals of afb_api_t
  and afb_req_t is bad when dealing with implicit
  conversion in C++ and is generally not the way to
  go.

Change-Id: I2630faa5ea0ae315ca95e4fd6ed6ae1a0beb01a5
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
include/afb/afb-binding-predefs.h
include/afb/afb-binding-v3.h

index 47907a4..eff424c 100644 (file)
 #define afb_api_x3_set_userdata                afb_api_set_userdata
 #define afb_api_x3_wants_log_level     afb_api_wants_log_level
 
+#define afb_api_x3_vverbose            afb_api_vverbose
 #define afb_api_x3_verbose             afb_api_verbose
 #define afb_api_x3_get_event_loop      afb_api_get_event_loop
 #define afb_api_x3_get_user_bus                afb_api_get_user_bus
index 84af486..287925f 100644 (file)
@@ -192,8 +192,8 @@ extern const struct afb_binding_v3 afbBindingV3;
 
 # define AFB_API_VERBOSE_V3(api,level,...) \
                do { if(level <= AFB_VERBOSITY_LEVEL_ERROR) \
-                       afb_api_v3_verbose(api,level,__FILE__,__LINE__,NULL,__VA_ARGS__); \
-               else afb_api_v3_verbose(api,level,__FILE__,__LINE__,NULL); } while(0)
+                       afb_api_x3_verbose(api,level,__FILE__,__LINE__,NULL,__VA_ARGS__); \
+               else afb_api_x3_verbose(api,level,__FILE__,__LINE__,NULL); } while(0)
 
 # define AFB_REQ_VERBOSE_V3(req,level,...) \
                do { if(level <= AFB_VERBOSITY_LEVEL_ERROR) \
@@ -203,7 +203,7 @@ extern const struct afb_binding_v3 afbBindingV3;
 #elif defined(AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS)
 
 # define AFB_API_VERBOSE_V3(api,level,...) \
-       afb_api_v3_verbose(api,level,NULL,0,NULL,__VA_ARGS__)
+       afb_api_x3_verbose(api,level,NULL,0,NULL,__VA_ARGS__)
 
 # define AFB_REQ_VERBOSE_V3(req,level,...) \
        afb_req_x2_verbose(req,level,NULL,0,NULL,__VA_ARGS__)
@@ -219,9 +219,9 @@ extern const struct afb_binding_v3 afbBindingV3;
 #endif
 
 #define _AFB_API_LOGGING_V3_(api,llevel,...) \
-        do{ if(AFB_SYSLOG_MASK_WANT((api)->logmask,(llevel))) AFB_API_VERBOSE_V3((api),(llevel),__VA_ARGS__); }while(0)
+        do{ if(afb_api_wants_log_level((api),(llevel))) AFB_API_VERBOSE_V3((api),(llevel),__VA_ARGS__); }while(0)
 #define _AFB_REQ_LOGGING_V3_(req,llevel,...) \
-        do{ if(AFB_SYSLOG_MASK_WANT((req)->api->logmask,(llevel))) AFB_REQ_VERBOSE_V3((req),(llevel),__VA_ARGS__); }while(0)
+        do{ if(afb_req_wants_log_level((req),(llevel))) AFB_REQ_VERBOSE_V3((req),(llevel),__VA_ARGS__); }while(0)
 
 #define AFB_API_ERROR_V3(api,...)              _AFB_API_LOGGING_V3_(api,AFB_SYSLOG_LEVEL_ERROR,__VA_ARGS__)
 #define AFB_API_WARNING_V3(api,...)            _AFB_API_LOGGING_V3_(api,AFB_SYSLOG_LEVEL_WARNING,__VA_ARGS__)