New version (0.1.2).

This commit is contained in:
Daniel Lemire 2019-05-09 20:55:26 -04:00
parent f75280ac9c
commit 954b89e762
5 changed files with 29 additions and 28 deletions

View File

@ -11,8 +11,8 @@ project(simdjson)
set(SIMDJSON_LIB_NAME simdjson)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 1)
set(SIMDJSON_LIB_VERSION "0.1.1" CACHE STRING "simdjson library version")
set(PROJECT_VERSION_PATCH 2)
set(SIMDJSON_LIB_VERSION "0.1.2" CACHE STRING "simdjson library version")
set(SIMDJSON_LIB_SOVERSION "0" CACHE STRING "simdjson library soversion")
if(NOT MSVC)

View File

@ -1,10 +1,10 @@
// /include/simdjson/simdjson_version.h automatically generated by release.py, do not change by hand
#ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION
#define SIMDJSON_INCLUDE_SIMDJSON_VERSION
#define SIMDJSON_VERSION 0.1.1
#define SIMDJSON_VERSION 0.1.2
enum {
SIMDJSON_VERSION_MAJOR = 0,
SIMDJSON_VERSION_MINOR = 1,
SIMDJSON_VERSION_REVISION = 1
SIMDJSON_VERSION_REVISION = 2
};
#endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION

View File

@ -1,4 +1,4 @@
/* auto-generated on Thu May 9 17:40:56 EDT 2019. Do not edit! */
/* auto-generated on Thu May 9 20:55:13 EDT 2019. Do not edit! */
#include <iostream>
#include "simdjson.h"

View File

@ -1,4 +1,4 @@
/* auto-generated on Thu May 9 17:40:56 EDT 2019. Do not edit! */
/* auto-generated on Thu May 9 20:55:13 EDT 2019. Do not edit! */
#include "simdjson.h"
/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */
@ -1102,8 +1102,8 @@ int unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
pj.write_tape(0, 'r'); // r for root, 0 is going to get overwritten
// the root is used, if nothing else, to capture the size of the tape
depth++; // everything starts at depth = 1, depth = 0 is just for the root, the root may contain an object, an array or something else.
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
UPDATE_CHAR();
@ -1116,8 +1116,8 @@ int unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
pj.ret_address[depth] = 's';
#endif
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
pj.write_tape(0, c); // strangely, moving this to object_begin slows things down
goto object_begin;
@ -1129,8 +1129,8 @@ int unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
pj.ret_address[depth] = 's';
#endif
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
pj.write_tape(0, c);
goto array_begin;
@ -1331,8 +1331,8 @@ object_key_state:
#endif
// we found an object inside an object, so we need to increment the depth
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
goto object_begin;
@ -1348,8 +1348,8 @@ object_key_state:
#endif
// we found an array inside an object, so we need to increment the depth
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
goto array_begin;
}
@ -1463,8 +1463,8 @@ main_array_switch:
#endif
// we found an object inside an array, so we need to increment the depth
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
goto object_begin;
@ -1480,8 +1480,8 @@ main_array_switch:
#endif
// we found an array inside an array, so we need to increment the depth
depth++;
if (depth > pj.depthcapacity) {
goto fail;
if (depth >= pj.depthcapacity) {
return simdjson::DEPTH_ERROR;
}
goto array_begin;
}
@ -1582,10 +1582,11 @@ bool ParsedJson::allocateCapacity(size_t len, size_t maxdepth) {
n_structural_indexes = 0;
uint32_t max_structures = ROUNDUP_N(len, 64) + 2 + 7;
structural_indexes = new (std::nothrow) uint32_t[max_structures];
size_t localtapecapacity = ROUNDUP_N(len, 64);
// a pathological input like "[[[[..." would generate len tape elements, so need a capacity of len + 1
size_t localtapecapacity = ROUNDUP_N(len + 1, 64);
// a document with only zero-length strings... could have len/3 string
// and we would need len/3 * 5 bytes on the string buffer
size_t localstringcapacity = ROUNDUP_N(5 * len / 3 + 32, 64);
size_t localstringcapacity = ROUNDUP_N(5 * len / 3 + 32, 64);
string_buf = new (std::nothrow) uint8_t[localstringcapacity];
tape = new (std::nothrow) uint64_t[localtapecapacity];
containing_scope_offset = new (std::nothrow) uint32_t[maxdepth];

View File

@ -1,13 +1,13 @@
/* auto-generated on Thu May 9 17:40:56 EDT 2019. Do not edit! */
/* auto-generated on Thu May 9 20:55:13 EDT 2019. Do not edit! */
/* begin file include/simdjson/simdjson_version.h */
// /include/simdjson/simdjson_version.h automatically generated by release.py, do not change by hand
#ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION
#define SIMDJSON_INCLUDE_SIMDJSON_VERSION
#define SIMDJSON_VERSION 0.1.1
#define SIMDJSON_VERSION 0.1.2
enum {
SIMDJSON_VERSION_MAJOR = 0,
SIMDJSON_VERSION_MINOR = 1,
SIMDJSON_VERSION_REVISION = 1
SIMDJSON_VERSION_REVISION = 2
};
#endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION
/* end file include/simdjson/simdjson_version.h */
@ -23,11 +23,13 @@ struct simdjson {
CAPACITY, // This ParsedJson can't support a document that big
MEMALLOC, // Error allocating memory, most likely out of memory
TAPE_ERROR, // Something went wrong while writing to the tape
DEPTH_ERROR, // Your document exceeds the user-specified depth limitation
};
static const std::string& errorMsg(const int);
};
#endif/* end file include/simdjson/simdjson.h */
#endif
/* end file include/simdjson/simdjson.h */
/* begin file include/simdjson/portability.h */
#ifndef SIMDJSON_PORTABILITY_H
#define SIMDJSON_PORTABILITY_H
@ -199,8 +201,6 @@ static inline void aligned_free_char(char *memblock) {
#endif
// Align to N-byte boundary
#define ROUNDUP_N(a, n) (((a) + ((n)-1)) & ~((n)-1))
#define ROUNDDOWN_N(a, n) ((a) & ~((n)-1))