Function behaviour changed.

FossilOrigin-Name: 09a2a2413e6ddbf1b4b5350fe443c7036ad17e6e118cb9fc44da4555393a5d32
This commit is contained in:
7u83@mail.ru 2015-01-31 11:29:27 +00:00
parent ce5a7b990d
commit 446d6308d0
2 changed files with 9 additions and 6 deletions

View File

@ -3,5 +3,8 @@
extern uint8_t * bstr_create(uint8_t *data, uint8_t len);
extern uint8_t * bstr_create_from_cfgstr(const char * s);
extern uint8_t * bstr_replace( uint8_t ** dst, uint8_t * bstr);
#define bstr_len(s) (*s)

View File

@ -2,11 +2,11 @@
#include "bstr.h"
uint8_t * bstr_replace( uint8_t ** str, uint8_t * data, int len)
uint8_t * bstr_replace( uint8_t ** dst, uint8_t * bstr)
{
if (str)
free(str);
*str = bstr_create(data,len);
return *str;
if (*dst)
free(*dst);
*dst = bstr;
return *dst;
}