MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / copy

Method copy

source/util/bstring.cpp:941–951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941BString BString::copy(const char* s) {
942 if (!s || s[0]==0) {
943 return empty;
944 }
945 BString result(allocNewData());
946 result.data->len = (int)strlen(s);
947 result.data->level = powerOf2(result.data->len + 1);
948 result.data->str = getNewString(result.data->level);
949 memcpy(result.data->str, s, result.data->len + 1);
950 return result;
951}
952
953BString BString::copy(const char* s, int len) {
954 if (!s) {

Callers

nothing calls this directly

Calls 4

allocNewDataFunction · 0.85
getNewStringFunction · 0.85
memcpyFunction · 0.85
powerOf2Function · 0.70

Tested by

no test coverage detected