diff options
author | Loïc Collignon <loic.collignon@iot.bzh> | 2019-07-08 14:47:30 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-07-09 08:18:40 +0000 |
commit | 3aa80df989dc52a010a40b247975fd779a43157f (patch) | |
tree | 0f0ee0d38ee686c608564e02860054078fb50424 /include/afb/c++ | |
parent | 28720882da28205568591a8b59f6565200d201af (diff) |
Fix syntax error in a constexpr function
The function declaration contains a syntax error that was somehow
ignored but raise an error about an illegal cast in a constexpr
function.
Fixed this error and clean up a bit surrounding code to be more concise.
Bug-AGL: SPEC-2615
Change-Id: I931b086c96b093b3de4465c51dfc3e865f7ece3b
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'include/afb/c++')
-rw-r--r-- | include/afb/c++/binding-wrap.hpp | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/include/afb/c++/binding-wrap.hpp b/include/afb/c++/binding-wrap.hpp index 6af3f845..9a9ad85c 100644 --- a/include/afb/c++/binding-wrap.hpp +++ b/include/afb/c++/binding-wrap.hpp @@ -753,15 +753,7 @@ constexpr afb_verb_t verb( void *vcbdata = nullptr ) { - afb_verb_t r = { 0, 0, 0, 0, 0, 0, 0 }; - r.verb = name; - r.callback = callback; - r.info = info; - r.session = session; - r.auth = auth; - r.glob = (uint16_t)glob; - r.vcbdata = vcbdata; - return r; + return { name, callback, auth, info, vcbdata, session, glob }; } void __attribute__((weak)) __afb__verb__cb__for__global__(afb_req_t r) @@ -776,12 +768,11 @@ void __attribute__((weak)) __afb__verb__cb__for__global__(afb_req_t r) constexpr afb_verb_t verb( const char *name, - void (&callback)(req), + void (*callback)(req), const char *info = nullptr, uint16_t session = 0, const afb_auth *auth = nullptr, - bool glob = false, - void *vcbdata = nullptr + bool glob = false ) { return verb( @@ -797,8 +788,7 @@ constexpr afb_verb_t verb( constexpr afb_verb_t verbend() { - afb_verb_t r = verb(nullptr, nullptr); - return r; + return { 0, 0, 0, 0, 0, 0, 0 }; } constexpr afb_binding_t binding( @@ -813,17 +803,9 @@ constexpr afb_binding_t binding( void *userdata = nullptr ) { - afb_binding_t r = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - r.api = name; - r.specification = specification; - r.info = info; - r.verbs = verbs; - r.preinit = preinit; - r.init = init; - r.onevent = onevent; - r.noconcurrency = noconcurrency ? 1 : 0; - r.userdata = userdata; - return r; + return { + name, specification, info, verbs, preinit, init, onevent, userdata, + nullptr, nullptr, nullptr, static_cast<unsigned int>(noconcurrency) }; }; /*************************************************************************/ |