fix rocksdb_version on openbsd

master
Niko PLP 7 months ago
parent 9355119ae0
commit 9fedf34e56
  1. 14
      librocksdb-sys/api/c.cc
  2. 2
      librocksdb-sys/build.rs

@ -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(

@ -472,7 +472,7 @@ fn main() {
bindgen_rocksdb(); bindgen_rocksdb();
if !try_to_find_and_link_lib("ROCKSDB") { if !try_to_find_and_link_lib("ROCKSDB") {
println!("cargo:rerun-if-changed=librocksdb-sys/rocksdb/"); println!("cargo:rerun-if-changed=librocksdb-sys/");
fail_on_empty_directory("librocksdb-sys/rocksdb"); fail_on_empty_directory("librocksdb-sys/rocksdb");
build_rocksdb(); build_rocksdb();
} else { } else {

Loading…
Cancel
Save