summaryrefslogtreecommitdiffstats
path: root/src/afb-api-so.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-03-27 11:23:51 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-03-27 11:23:51 +0200
commit44f21bd2a3b50f92669223cdafe79993654c1e19 (patch)
treeb8656cf9c11f25183bd95822c085ce35a459a9e5 /src/afb-api-so.c
parentfeccdb76f572a5fad947475c21b5b9aff696b04b (diff)
Simplify functions for calls
For historical reasons, the call to apis was passing the length of the api and the length of the verb. The reason was to avoid a copy of strings. But the copy occured only for HTTP requests. Having this implementation is of small interest and compromise future changes. This patch simplify things. Change-Id: I8157724c6c721b6797cd0eab52b07e1b8d6eb5f8 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-api-so.c')
-rw-r--r--src/afb-api-so.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/afb-api-so.c b/src/afb-api-so.c
index 222fbbbd..daa35334 100644
--- a/src/afb-api-so.c
+++ b/src/afb-api-so.c
@@ -182,16 +182,16 @@ static int call_check(struct afb_req req, struct afb_context *context, const str
return 1;
}
-static void call_cb(void *closure, struct afb_req req, struct afb_context *context, const char *strverb, size_t lenverb)
+static void call_cb(void *closure, struct afb_req req, struct afb_context *context, const char *strverb)
{
const struct afb_verb_desc_v1 *verb;
struct api_so_desc *desc = closure;
verb = desc->binding->v1.verbs;
- while (verb->name && (strncasecmp(verb->name, strverb, lenverb) || verb->name[lenverb]))
+ while (verb->name && strcasecmp(verb->name, strverb))
verb++;
if (!verb->name)
- afb_req_fail_f(req, "unknown-verb", "verb %.*s unknown within api %s", (int)lenverb, strverb, desc->binding->v1.prefix);
+ afb_req_fail_f(req, "unknown-verb", "verb %s unknown within api %s", strverb, desc->binding->v1.prefix);
else if (call_check(req, context, verb)) {
afb_thread_req_call(req, verb->callback, api_timeout, desc);
}