|
|
@ -3,12 +3,12 @@ |
|
|
|
#include <cstring> |
|
|
|
#include <cstring> |
|
|
|
#include "c.h" |
|
|
|
#include "c.h" |
|
|
|
|
|
|
|
|
|
|
|
// static char* CopyString(const std::string& str) {
|
|
|
|
static char* CopyString2(const std::string& str) { |
|
|
|
// char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size()+1));
|
|
|
|
char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size()+1)); |
|
|
|
// memcpy(result, str.data(), sizeof(char) * str.size());
|
|
|
|
memcpy(result, str.data(), sizeof(char) * str.size()); |
|
|
|
// result[sizeof(char) * str.size()] = 0;
|
|
|
|
result[sizeof(char) * str.size()] = 0; |
|
|
|
// return result;
|
|
|
|
return result; |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool SaveStatus(rocksdb_status_t* target, const Status source) { |
|
|
|
static bool SaveStatus(rocksdb_status_t* target, const Status source) { |
|
|
|
target->code = static_cast<rocksdb_status_code_t>(source.code()); |
|
|
|
target->code = static_cast<rocksdb_status_code_t>(source.code()); |
|
|
@ -30,7 +30,7 @@ extern "C" { |
|
|
|
|
|
|
|
|
|
|
|
char* rocksdb_version() { |
|
|
|
char* rocksdb_version() { |
|
|
|
auto name = ROCKSDB_NAMESPACE::GetRocksVersionAsString(true); |
|
|
|
auto name = ROCKSDB_NAMESPACE::GetRocksVersionAsString(true); |
|
|
|
return CopyString(name); |
|
|
|
return CopyString2(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rocksdb_pinnableslice_t* rocksdb_get_pinned_cf_with_status( |
|
|
|
rocksdb_pinnableslice_t* rocksdb_get_pinned_cf_with_status( |
|
|
|