Browse Source

Merge pull request #411 from proller:assert1

PiperOrigin-RevId: 247424040
main
Chris Mumford 5 years ago
parent
commit
1aae5c9f29
2 changed files with 6 additions and 3 deletions
  1. +5
    -1
      db/dbformat.h
  2. +1
    -2
      db/version_edit.cc

+ 5
- 1
db/dbformat.h View File

@ -139,7 +139,11 @@ class InternalKey {
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t)); 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 { Slice Encode() const {
assert(!rep_.empty()); assert(!rep_.empty());
return rep_; return rep_;

+ 1
- 2
db/version_edit.cc View File

@ -86,8 +86,7 @@ void VersionEdit::EncodeTo(std::string* dst) const {
static bool GetInternalKey(Slice* input, InternalKey* dst) { static bool GetInternalKey(Slice* input, InternalKey* dst) {
Slice str; Slice str;
if (GetLengthPrefixedSlice(input, &str)) { if (GetLengthPrefixedSlice(input, &str)) {
dst->DecodeFrom(str);
return true;
return dst->DecodeFrom(str);
} else { } else {
return false; return false;
} }

Loading…
Cancel
Save