MCPcopy Create free account
hub / github.com/arvidn/libtorrent / copy_string

Method copy_string

src/stack_allocator.cpp:39–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37namespace aux {
38
39 allocation_slot stack_allocator::copy_string(string_view str)
40 {
41 auto const ret = m_storage.size();
42 if (std::numeric_limits<int>::max() - str.size() <= ret)
43 return {};
44 m_storage.resize(ret + str.size() + 1);
45 std::memcpy(&m_storage[ret], str.data(), str.size());
46 m_storage[ret + str.length()] = '\0';
47 return allocation_slot(ret);
48 }
49
50 allocation_slot stack_allocator::copy_string(char const* str)
51 {

Callers 15

TORRENT_TESTFunction · 0.45
name_idxMethod · 0.45
tracker_alertMethod · 0.45
file_renamed_alertMethod · 0.45
tracker_error_alertMethod · 0.45
tracker_warning_alertMethod · 0.45
scrape_failed_alertMethod · 0.45
storage_moved_alertMethod · 0.45
listen_failed_alertMethod · 0.45
portmap_log_alertMethod · 0.45

Calls 5

maxFunction · 0.85
allocation_slotClass · 0.85
sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TORRENT_TESTFunction · 0.36