@ -207,19 +207,10 @@ void Status::UnrefNonInlined(uintptr_t rep) {
}
}
}
}
uintptr_t Status : : NewRep (
absl : : StatusCode code , absl : : string_view msg ,
std : : unique_ptr < status_internal : : Payloads > payloads ) {
status_internal : : StatusRep * rep = new status_internal : : StatusRep (
code , std : : string ( msg . data ( ) , msg . size ( ) ) ,
std : : move ( payloads ) ) ;
return PointerToRep ( rep ) ;
}
Status : : Status ( absl : : StatusCode code , absl : : string_view msg )
Status : : Status ( absl : : StatusCode code , absl : : string_view msg )
: rep_ ( CodeToInlinedRep ( code ) ) {
: rep_ ( CodeToInlinedRep ( code ) ) {
if ( code ! = absl : : StatusCode : : kOk & & ! msg . empty ( ) ) {
if ( code ! = absl : : StatusCode : : kOk & & ! msg . empty ( ) ) {
rep_ = New Rep( code , msg , nullptr ) ;
rep_ = PointerToRep ( new status_internal : : StatusRep ( code , msg , nullptr ) ) ;
}
}
}
}
@ -238,9 +229,9 @@ absl::StatusCode Status::code() const {
void Status : : PrepareToModify ( ) {
void Status : : PrepareToModify ( ) {
ABSL_RAW_CHECK ( ! ok ( ) , " PrepareToModify shouldn't be called on OK status. " ) ;
ABSL_RAW_CHECK ( ! ok ( ) , " PrepareToModify shouldn't be called on OK status. " ) ;
if ( IsInlined ( rep_ ) ) {
if ( IsInlined ( rep_ ) ) {
rep_ =
rep_ = PointerToRep ( new status_internal : : StatusRep (
NewRep ( static_cast < absl : : StatusCode > ( raw_code ( ) ) , absl : : string_view ( ) ,
static_cast < absl : : StatusCode > ( raw_code ( ) ) , absl : : string_view ( ) ,
nullptr ) ;
nullptr ) ) ;
return ;
return ;
}
}
@ -251,8 +242,9 @@ void Status::PrepareToModify() {
if ( rep - > payloads ) {
if ( rep - > payloads ) {
payloads = absl : : make_unique < status_internal : : Payloads > ( * rep - > payloads ) ;
payloads = absl : : make_unique < status_internal : : Payloads > ( * rep - > payloads ) ;
}
}
rep_ = NewRep ( rep - > code , message ( ) ,
status_internal : : StatusRep * const new_rep = new status_internal : : StatusRep (
std : : move ( payloads ) ) ;
rep - > code , message ( ) , std : : move ( payloads ) ) ;
rep_ = PointerToRep ( new_rep ) ;
UnrefNonInlined ( rep_i ) ;
UnrefNonInlined ( rep_i ) ;
}
}
}
}