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
This commit is contained in:
parent
054c5dda8c
commit
eda924a03a
@ -39,6 +39,7 @@ extern void PutLengthPrefixedSliceParts(std::string* dst,
|
|||||||
extern bool GetVarint32(Slice* input, uint32_t* value);
|
extern bool GetVarint32(Slice* input, uint32_t* value);
|
||||||
extern bool GetVarint64(Slice* input, uint64_t* value);
|
extern bool GetVarint64(Slice* input, uint64_t* value);
|
||||||
extern bool GetLengthPrefixedSlice(Slice* input, Slice* result);
|
extern bool GetLengthPrefixedSlice(Slice* input, Slice* result);
|
||||||
|
// This function assumes data is well-formed.
|
||||||
extern Slice GetLengthPrefixedSlice(const char* data);
|
extern Slice GetLengthPrefixedSlice(const char* data);
|
||||||
|
|
||||||
extern Slice GetSliceUntil(Slice* slice, char delimiter);
|
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) {
|
inline bool GetLengthPrefixedSlice(Slice* input, Slice* result) {
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
if (GetVarint32(input, &len) && input->size() >= len) {
|
if (GetVarint32(input, &len) && input->size() >= len) {
|
||||||
@ -272,8 +263,8 @@ inline bool GetLengthPrefixedSlice(Slice* input, Slice* result) {
|
|||||||
|
|
||||||
inline Slice GetLengthPrefixedSlice(const char* data) {
|
inline Slice GetLengthPrefixedSlice(const char* data) {
|
||||||
uint32_t len = 0;
|
uint32_t len = 0;
|
||||||
const char* p = data;
|
// +5: we assume "data" is not corrupted
|
||||||
p = GetVarint32Ptr(p, p + 5, &len); // +5: we assume "p" is not corrupted
|
auto p = GetVarint32Ptr(data, data + 5 /* limit */, &len);
|
||||||
return Slice(p, len);
|
return Slice(p, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user