2018-02-28 09:05:45 +01:00
|
|
|
#include "bstr.h"
|
|
|
|
|
2018-04-04 10:59:07 +02:00
|
|
|
bstr16_t bstr16_create(const uint8_t *data, uint16_t len)
|
2018-02-28 09:05:45 +01:00
|
|
|
{
|
|
|
|
uint8_t * str = malloc(2+len*sizeof(uint8_t));
|
|
|
|
if (!str)
|
|
|
|
return 0;
|
|
|
|
*((uint16_t*)str)=len;
|
|
|
|
memcpy(str+2,data,len);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|