Skip to content

Commit

Permalink
Merge pull request #411 from proller:assert1
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 247424040
  • Loading branch information
cmumford committed May 9, 2019
2 parents b7b86ba + 7d06011 commit 1aae5c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion db/dbformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ class InternalKey {
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t));
}

void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); }
bool DecodeFrom(const Slice& s) {
rep_.assign(s.data(), s.size());
return !rep_.empty();
}

Slice Encode() const {
assert(!rep_.empty());
return rep_;
Expand Down
3 changes: 1 addition & 2 deletions db/version_edit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ void VersionEdit::EncodeTo(std::string* dst) const {
static bool GetInternalKey(Slice* input, InternalKey* dst) {
Slice str;
if (GetLengthPrefixedSlice(input, &str)) {
dst->DecodeFrom(str);
return true;
return dst->DecodeFrom(str);
} else {
return false;
}
Expand Down

0 comments on commit 1aae5c9

Please sign in to comment.