afb-api: Define the function afb_api_is_public 57/15657/1
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 24 Jul 2018 08:00:17 +0000 (10:00 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Tue, 24 Jul 2018 14:28:32 +0000 (16:28 +0200)
And remove the info line setting that the API .
is added.

Change-Id: I42e247036b9a1016797bb2674ad95f8a8c30e9be
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-api.h
src/afb-apiset.c
src/afb-hook.c

index 821bccb..c21f3bb 100644 (file)
@@ -41,4 +41,9 @@ struct afb_api_item
 
 extern int afb_api_is_valid_name(const char *name);
 
+static inline int afb_api_is_public(const char *name)
+{
+       return *name != '.';
+}
+
 
index 994a9c7..f837fae 100644 (file)
@@ -495,7 +495,8 @@ int afb_apiset_add(struct afb_apiset *set, const char *name, struct afb_api_item
        desc->next = all_apis;
        all_apis = desc;
 
-       INFO("API %s added", name);
+       if (afb_api_is_public(name))
+               INFO("API %s added", name);
 
        return 0;
 
index 48eb582..6956a83 100644 (file)
@@ -45,7 +45,7 @@
 #define MATCH(pattern,string)   (\
                pattern \
                        ? !fnmatch((pattern),(string),FNM_CASEFOLD|FNM_EXTMATCH|FNM_PERIOD) \
-                       : (string)[0] != '.')
+                       : afb_api_is_public(string))
 
 #define MATCH_API(pattern,string)      MATCH(pattern,string)
 #define MATCH_VERB(pattern,string)     MATCH(pattern,string)