diff --git a/benchmark/partial_tweets/iter.h b/benchmark/partial_tweets/iter.h index 22248ba2c..d874e46b1 100644 --- a/benchmark/partial_tweets/iter.h +++ b/benchmark/partial_tweets/iter.h @@ -47,13 +47,13 @@ simdjson_really_inline bool Iter::Run(const padded_string &json) { tweet tweet; if (!iter.start_object() || !iter.find_field_raw("created_at")) { return false; } - tweet.created_at = iter.consume_raw_json_string().value().unescape(iter); + tweet.created_at = iter.consume_string(); if (!iter.has_next_field() || !iter.find_field_raw("id")) { return false; } tweet.id = iter.consume_uint64(); if (!iter.has_next_field() || !iter.find_field_raw("text")) { return false; } - tweet.text = iter.consume_raw_json_string().value().unescape(iter); + tweet.text = iter.consume_string(); if (!iter.has_next_field() || !iter.find_field_raw("in_reply_to_status_id")) { return false; } if (!iter.is_null()) { @@ -66,7 +66,7 @@ simdjson_really_inline bool Iter::Run(const padded_string &json) { tweet.user.id = iter.consume_uint64(); if (!iter.has_next_field() || !iter.find_field_raw("screen_name")) { return false; } - tweet.user.screen_name = iter.consume_raw_json_string().value().unescape(iter); + tweet.user.screen_name = iter.consume_string(); if (iter.skip_container()) { return false; } // Skip the rest of the user object } diff --git a/include/simdjson/generic/ondemand/json_iterator-inl.h b/include/simdjson/generic/ondemand/json_iterator-inl.h index 02a33326c..d1a3b5592 100644 --- a/include/simdjson/generic/ondemand/json_iterator-inl.h +++ b/include/simdjson/generic/ondemand/json_iterator-inl.h @@ -2,12 +2,13 @@ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { namespace ondemand { -#ifdef SIMDJSON_ONDEMAND_SAFETY_RAILS simdjson_really_inline json_iterator::json_iterator(json_iterator &&other) noexcept : token_iterator(std::forward(other)), parser{other.parser}, - current_string_buf_loc{other.current_string_buf_loc}, - active_lease_depth{other.active_lease_depth} + current_string_buf_loc{other.current_string_buf_loc} +#ifdef SIMDJSON_ONDEMAND_SAFETY_RAILS + , active_lease_depth{other.active_lease_depth} +#endif { other.parser = nullptr; } @@ -16,11 +17,12 @@ simdjson_really_inline json_iterator &json_iterator::operator=(json_iterator &&o index = other.index; parser = other.parser; current_string_buf_loc = other.current_string_buf_loc; +#ifdef SIMDJSON_ONDEMAND_SAFETY_RAILS active_lease_depth = other.active_lease_depth; +#endif other.parser = nullptr; return *this; } -#endif simdjson_really_inline json_iterator::json_iterator(ondemand::parser *_parser) noexcept : token_iterator(_parser->dom_parser.buf, _parser->dom_parser.structural_indexes.get()), diff --git a/include/simdjson/generic/ondemand/json_iterator.h b/include/simdjson/generic/ondemand/json_iterator.h index 18de6fce1..7a3e235b3 100644 --- a/include/simdjson/generic/ondemand/json_iterator.h +++ b/include/simdjson/generic/ondemand/json_iterator.h @@ -18,13 +18,11 @@ class json_iterator_ref; class json_iterator : public token_iterator { public: simdjson_really_inline json_iterator() noexcept = default; -#ifdef SIMDJSON_ONDEMAND_SAFETY_RAILS simdjson_really_inline json_iterator(json_iterator &&other) noexcept; simdjson_really_inline json_iterator &operator=(json_iterator &&other) noexcept; +#ifdef SIMDJSON_ONDEMAND_SAFETY_RAILS simdjson_really_inline ~json_iterator() noexcept; #else - simdjson_really_inline json_iterator(json_iterator &&other) noexcept = default; - simdjson_really_inline json_iterator &operator=(json_iterator &&other) noexcept = default; simdjson_really_inline ~json_iterator() noexcept = default; #endif simdjson_really_inline json_iterator(const json_iterator &other) noexcept = delete; diff --git a/include/simdjson/generic/ondemand/value-inl.h b/include/simdjson/generic/ondemand/value-inl.h index 4d6ad9987..5fb421069 100644 --- a/include/simdjson/generic/ondemand/value-inl.h +++ b/include/simdjson/generic/ondemand/value-inl.h @@ -40,15 +40,15 @@ simdjson_really_inline simdjson_result value::consume_if_success(simdjson_res } simdjson_really_inline simdjson_result value::get_array() noexcept { - bool is_empty; - SIMDJSON_TRY( iter->start_array(json).get(is_empty) ); - if (is_empty) { iter.release(); } + bool has_value; + SIMDJSON_TRY( iter->start_array(json).get(has_value) ); + if (!has_value) { iter.release(); } return array(std::move(iter)); } simdjson_really_inline simdjson_result value::get_object() noexcept { - bool is_empty; - SIMDJSON_TRY( iter->start_object(json).get(is_empty) ); - if (is_empty) { iter.release(); } + bool has_value; + SIMDJSON_TRY( iter->start_object(json).get(has_value) ); + if (!has_value) { iter.release(); } return object(std::move(iter)); } simdjson_really_inline simdjson_result value::get_raw_json_string() noexcept {