Commit c293b6d8 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

code cleanup for N1 functions

parent 539e6168
......@@ -99,3 +99,18 @@ void util::ipv4_to_bstring(struct in_addr ipv4_address, bstring str) {
memcpy(str->data, bitstream_addr,
sizeof(bitstream_addr));
}
void util::string_to_bstring(const std::string &str, bstring bstr) {
bstr =
bfromcstralloc(str.length(), "\0");
bstr->slen = str.length();
memcpy((void *)bstr->data,
(void *)str.c_str(),
str.length());
/*
std::string s(
(char *)bstr->data,
bstr->slen);
Logger::nrf_app().debug("Str %s", s.c_str());
*/
}
......@@ -48,5 +48,6 @@ std::string& trim(std::string &s);
void ipv4_to_bstring(struct in_addr ipv4_address, bstring str);
void string_to_bstring(const std::string &str, bstring bstr);
}
#endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment