| 939 | } |
| 940 | |
| 941 | BString 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 | |
| 953 | BString BString::copy(const char* s, int len) { |
| 954 | if (!s) { |
nothing calls this directly
no test coverage detected