Bladeren bron

IWYU fixes in db/c.cc.

Fixes https://github.com/google/leveldb/issues/872

PiperOrigin-RevId: 353657701
naive_version
Victor Costan 3 jaren geleden
bovenliggende
commit
4a919ea4f7
1 gewijzigde bestanden met toevoegingen van 8 en 5 verwijderingen
  1. +8
    -5
      db/c.cc

+ 8
- 5
db/c.cc Bestand weergeven

@ -4,6 +4,8 @@
#include "leveldb/c.h"
#include <string.h>
#include <cstdint>
#include <cstdlib>
@ -119,7 +121,7 @@ struct leveldb_filterpolicy_t : public FilterPolicy {
size_t len;
char* filter = (*create_)(state_, &key_pointers[0], &key_sizes[0], n, &len);
dst->append(filter, len);
free(filter);
std::free(filter);
}
bool KeyMayMatch(const Slice& key, const Slice& filter) const override {
@ -150,14 +152,15 @@ static bool SaveError(char** errptr, const Status& s) {
*errptr = strdup(s.ToString().c_str());
} else {
// TODO(sanjay): Merge with existing error?
free(*errptr);
std::free(*errptr);
*errptr = strdup(s.ToString().c_str());
}
return true;
}
static char* CopyString(const std::string& str) {
char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size()));
char* result =
reinterpret_cast<char*>(std::malloc(sizeof(char) * str.size()));
std::memcpy(result, str.data(), sizeof(char) * str.size());
return result;
}
@ -547,13 +550,13 @@ char* leveldb_env_get_test_directory(leveldb_env_t* env) {
return nullptr;
}
char* buffer = static_cast<char*>(malloc(result.size() + 1));
char* buffer = static_cast<char*>(std::malloc(result.size() + 1));
std::memcpy(buffer, result.data(), result.size());
buffer[result.size()] = '\0';
return buffer;
}
void leveldb_free(void* ptr) { free(ptr); }
void leveldb_free(void* ptr) { std::free(ptr); }
int leveldb_major_version() { return kMajorVersion; }

Laden…
Annuleren
Opslaan