AntiTopQuark commented on code in PR #2277:
URL: https://github.com/apache/kvrocks/pull/2277#discussion_r1581820269
##########
src/storage/rdb.cc:
##########
@@ -1005,3 +1000,37 @@ Status RDB::rdbSaveBinaryDoubleValue(double val) {
memrev64ifbe(&val);
return stream_->Write((const char *)(&val), sizeof(val));
}
+
+Status RDB::rdbSaveZipListObject(const std::string &elem) {
+ // calc total ziplist size
+ uint prevlen = 0;
+ const size_t ziplist_size = zlHeaderSize + zlEndSize + elem.length() +
+ ZipList::zipStorePrevEntryLength(nullptr,
prevlen) +
+ ZipList::zipStoreEntryEncoding(nullptr,
elem.length());
+ auto zl = new unsigned char[ziplist_size];
Review Comment:
I have changed the code from using `new` directly to using
`std::make_unique` for memory management.
Thank you for your review and suggestions!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]