Inline nsapi_create_stack(NetworkStack)

The rather fiddly `nsapi_create_stack` template + overloads used during
socket formation don't inline their core, which is the identity operation
for `NetworkStack *` itself. Make code generation easier by having that
core be inline.
pull/12467/head
Kevin Bracey 2020-02-18 14:17:13 +02:00
parent bac5ffec85
commit f40c5616e1
3 changed files with 9 additions and 15 deletions

View File

@ -68,11 +68,6 @@ NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
return reinterpret_cast<NetworkStack *>(stack);
}
NetworkStack *nsapi_create_stack(NetworkStack *stack)
{
return reinterpret_cast<NetworkStack *>(stack);
}
nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version,
const char *interface_name)
{

View File

@ -445,8 +445,3 @@ NetworkStack *nsapi_create_stack(nsapi_stack_t *stack)
return new (stack->_stack_buffer) NetworkStackWrapper;
}
NetworkStack *nsapi_create_stack(NetworkStack *stack)
{
return stack;
}

View File

@ -483,14 +483,18 @@ private:
/** Convert a raw nsapi_stack_t object into a C++ NetworkStack object
*
* @param stack Reference to an object that can be converted to a stack
* @param stack Pointer to an object that can be converted to a stack
* - A raw nsapi_stack_t object
* - A reference to a network stack
* - A reference to a network interface
* @return Reference to the underlying network stack
* - A pointer to a network stack
* - A pointer to a network interface
* @return Pointer to the underlying network stack
*/
NetworkStack *nsapi_create_stack(nsapi_stack_t *stack);
NetworkStack *nsapi_create_stack(NetworkStack *stack);
inline NetworkStack *nsapi_create_stack(NetworkStack *stack)
{
return stack;
}
template <typename IF>
NetworkStack *nsapi_create_stack(IF *iface)