aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-apiset.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-04-20 09:35:23 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-04-20 09:35:23 +0200
commitaf552129e778954878a3a3b4e0138fdb2c1f2602 (patch)
treeb729d9b83df1d5e4aa2ad33bb1074be347d80485 /src/afb-apiset.c
parentc82c7a70449d31e2fc05c486e9959cb68b371e8e (diff)
Use of 'afb_api_is_valid_name'
Use the common function 'afb_api_is_valid_name' instead of 'afb_apiset_valid_name'. Change-Id: I2d761473d4aa1cd90adf1b7a2c1976e727b437fc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-apiset.c')
-rw-r--r--src/afb-apiset.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/afb-apiset.c b/src/afb-apiset.c
index d9a4e5e8..cf054460 100644
--- a/src/afb-apiset.c
+++ b/src/afb-apiset.c
@@ -91,42 +91,6 @@ static const struct api_desc *search(struct afb_apiset *set, const char *name)
}
/**
- * Checks wether 'name' is a valid API name.
- * @return 1 if valid, 0 otherwise
- */
-int afb_apiset_valid_name(const char *name)
-{
- unsigned char c;
-
- c = (unsigned char)*name;
- if (c == 0)
- /* empty names aren't valid */
- return 0;
-
- do {
- if (c < (unsigned char)'\x80') {
- switch(c) {
- default:
- if (c > ' ')
- break;
- case '"':
- case '#':
- case '%':
- case '&':
- case '\'':
- case '/':
- case '?':
- case '`':
- case '\\':
- case '\x7f':
- return 0;
- }
- }
- c = (unsigned char)*++name;
- } while(c != 0);
- return 1;
-}
-
struct afb_apiset *afb_apiset_addref(struct afb_apiset *set)
{
if (set)
@@ -225,7 +189,7 @@ int afb_apiset_add(struct afb_apiset *set, const char *name, struct afb_api api)
int i, c;
/* Checks the api name */
- if (!afb_apiset_valid_name(name)) {
+ if (!afb_api_is_valid_name(name)) {
ERROR("invalid api name forbidden (name is '%s')", name);
errno = EINVAL;
goto error;