MCPcopy Create free account
hub / github.com/apache/brpc / copy_state

Method copy_state

src/butil/status.cpp:113–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113Status::State* Status::copy_state(const State* s) {
114 const size_t n = status_size(s->size);
115 State* s2 = reinterpret_cast<State*>(malloc(n));
116 if (NULL == s2) {
117 // TODO: If we failed to allocate, the status will be OK.
118 return NULL;
119 }
120 s2->code = s->code;
121 s2->size = s->size;
122 s2->state_size = n;
123 char* msg_head = s2->message;
124 memcpy(msg_head, s->message, s->size);
125 msg_head[s->size] = '\0';
126 return s2;
127};
128
129std::string Status::error_str() const {
130 if (_state == NULL) {

Callers

nothing calls this directly

Calls 1

status_sizeFunction · 0.85

Tested by

no test coverage detected