Remove an unused `GetLengthPrefixedSlice`

Summary: We have 3 versions of GetLengthPrefixedSlice() and one of them is no longer in use.

Test Plan: make

Reviewers: sdong, igor, haobo, dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D15399
main
kailiu 11 years ago
parent 054c5dda8c
commit eda924a03a
  1. 15
      util/coding.h

@ -39,6 +39,7 @@ extern void PutLengthPrefixedSliceParts(std::string* dst,
extern bool GetVarint32(Slice* input, uint32_t* value);
extern bool GetVarint64(Slice* input, uint64_t* value);
extern bool GetLengthPrefixedSlice(Slice* input, Slice* result);
// This function assumes data is well-formed.
extern Slice GetLengthPrefixedSlice(const char* data);
extern Slice GetSliceUntil(Slice* slice, char delimiter);
@ -249,16 +250,6 @@ inline bool GetVarint64(Slice* input, uint64_t* value) {
}
}
inline const char* GetLengthPrefixedSlice(const char* p, const char* limit,
Slice* result) {
uint32_t len = 0;
p = GetVarint32Ptr(p, limit, &len);
if (p == nullptr) return nullptr;
if (p + len > limit) return nullptr;
*result = Slice(p, len);
return p + len;
}
inline bool GetLengthPrefixedSlice(Slice* input, Slice* result) {
uint32_t len = 0;
if (GetVarint32(input, &len) && input->size() >= len) {
@ -272,8 +263,8 @@ inline bool GetLengthPrefixedSlice(Slice* input, Slice* result) {
inline Slice GetLengthPrefixedSlice(const char* data) {
uint32_t len = 0;
const char* p = data;
p = GetVarint32Ptr(p, p + 5, &len); // +5: we assume "p" is not corrupted
// +5: we assume "data" is not corrupted
auto p = GetVarint32Ptr(data, data + 5 /* limit */, &len);
return Slice(p, len);
}

Loading…
Cancel
Save