Renamed vendrostr_t to bstr_t
FossilOrigin-Name: 34e1a661db71756f6c03fb4f21434179f25cd4c48a2407b22f8ca0a8396d79e1
This commit is contained in:
@ -2,20 +2,20 @@
|
||||
#include "format.h"
|
||||
|
||||
|
||||
uint8_t * vendorstr_create_from_str(uint32_t vendor_id,const char *s)
|
||||
uint8_t * bstrv_create_from_str(uint32_t vendor_id,const char *s)
|
||||
{
|
||||
int l = strlen(s);
|
||||
if (s[0]!='.')
|
||||
return vendorstr_create(vendor_id,(uint8_t*)s,l);
|
||||
return bstrv_create(vendor_id,(uint8_t*)s,l);
|
||||
|
||||
if (l<=2)
|
||||
return vendorstr_create(vendor_id,(uint8_t*)s,l);
|
||||
return bstrv_create(vendor_id,(uint8_t*)s,l);
|
||||
|
||||
if (s[1]=='.')
|
||||
return vendorstr_create(vendor_id,(uint8_t*)s+1,l-1);
|
||||
return bstrv_create(vendor_id,(uint8_t*)s+1,l-1);
|
||||
|
||||
if (s[1]!='x')
|
||||
return vendorstr_create(vendor_id,(uint8_t*)s,l);
|
||||
return bstrv_create(vendor_id,(uint8_t*)s,l);
|
||||
|
||||
/* the string starts with ".x" - read hexbytes */
|
||||
l-=2;
|
||||
@ -24,13 +24,13 @@ uint8_t * vendorstr_create_from_str(uint32_t vendor_id,const char *s)
|
||||
msize++;
|
||||
|
||||
|
||||
uint8_t * mem = malloc(vendorstr_size(msize));
|
||||
uint8_t * mem = malloc(bstrv_size(msize));
|
||||
if(!mem)
|
||||
return NULL;
|
||||
vendorstr_set_vendor_id(mem,vendor_id);
|
||||
vendorstr_set_len(mem,msize);
|
||||
bstrv_set_vendor_id(mem,vendor_id);
|
||||
bstrv_set_len(mem,msize);
|
||||
|
||||
cw_format_scan_hex_bytes(vendorstr_data(mem),s+2,l);
|
||||
cw_format_scan_hex_bytes(bstrv_data(mem),s+2,l);
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user