mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
e370a65383
* Improving portability. * Revisiting faulty logic regarding same-page overruns. * Disabling same-page overruns under VS. * Clarifying the documentation * Fix for issue 131 + being more explicit regarding memory realloc. * Fix for issue 137. * removing "using namespace std" throughout. Fix for 50 * Introducing typed malloc/free. * Introducing a custom class (padded_string) that solves several minor usability issues. * Updating amalgamation for testing.
27 lines
799 B
C++
27 lines
799 B
C++
#ifndef SIMDJSON_JSONMINIFIER_H
|
|
#define SIMDJSON_JSONMINIFIER_H
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
// Take input from buf and remove useless whitespace, write it to out; buf and
|
|
// out can be the same pointer. Result is null terminated,
|
|
// return the string length (minus the null termination).
|
|
size_t jsonminify(const uint8_t *buf, size_t len, uint8_t *out);
|
|
|
|
|
|
static inline size_t jsonminify(const char *buf, size_t len, char *out) {
|
|
return jsonminify(reinterpret_cast<const uint8_t *>(buf), len, reinterpret_cast<uint8_t *>(out));
|
|
}
|
|
|
|
|
|
static inline size_t jsonminify(const std::string_view & p, char *out) {
|
|
return jsonminify(p.data(), p.size(), out);
|
|
}
|
|
|
|
static inline size_t jsonminify(const padded_string & p, char *out) {
|
|
return jsonminify(p.data(), p.size(), out);
|
|
}
|
|
|
|
#endif
|