mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
95d8c81810
* When using C++11, we could violate the one definition rule * fix * simplifying * disabling new 'test' when using shared libs
14 lines
475 B
C++
14 lines
475 B
C++
#include "mylib.h"
|
|
#include <simdjson.h>
|
|
#include <memory>
|
|
|
|
simdjson::padded_string minify_json(const simdjson::padded_string& json) {
|
|
size_t length = json.size();
|
|
std::unique_ptr<char[]> buffer{new char[length]};
|
|
size_t new_length{};
|
|
auto error = simdjson::minify(json.data(), length, buffer.get(), new_length);
|
|
if (error) {
|
|
return simdjson::padded_string();
|
|
}
|
|
return simdjson::padded_string(std::string_view(buffer.get(), new_length));
|
|
} |