mirror of https://github.com/oxen-io/lokinet
add buffer helper
parent
06f7a3df52
commit
4e19ce8191
@ -0,0 +1,22 @@
|
||||
#ifndef LLARP_BUFFER_HPP
|
||||
#define LLARP_BUFFER_HPP
|
||||
|
||||
#include <llarp/buffer.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
/** initialize llarp_buffer_t from stack allocated buffer */
|
||||
template<typename T>
|
||||
llarp_buffer_t StackBuffer(T & stack)
|
||||
{
|
||||
llarp_buffer_t buff;
|
||||
buff.base = (char*) stack;
|
||||
buff.cur = (char*) stack;
|
||||
buff.sz = sizeof(stack);
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue