From 4a28e684ea1932dd2b1bb6ec690bceb0e55bd473 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 13 Oct 2026 17:27:03 +0200 Subject: [PATCH] Drop the position updates in the bulk \u path, which #5809 made unused Signed-off-by: Niels Lohmann --- include/nlohmann/detail/input/lexer.hpp | 9 +++------ single_include/nlohmann/json.hpp | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index 547610981..2ded0ea4e 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -235,9 +235,9 @@ class lexer : public lexer_base /// contiguous input: try to decode the 4 hex digits following `\\u` /// directly from the input buffer via hex_codepoint(), instead of 4 calls - /// to get(). On success, advances the adapter and the position counters - /// exactly as those 4 get() calls would (a hex digit is never '\n', so - /// only the flat counters move) and leaves @a current holding the last of + /// to get(). On success, advances the adapter exactly as those 4 get() + /// calls would (bulk_scan implies lazy_position, so there are no position + /// counters to advance) and leaves @a current holding the last of /// the 4 digits, just as the last such get() would; the codepoint is /// written to @a out. Makes no state change and returns false - for a /// pending unget, fewer than 4 remaining bytes, or any of the 4 bytes not @@ -257,9 +257,6 @@ class lexer : public lexer_base return false; } ia.bulk_skip(4); - // a hex digit is never a newline, so only the flat counters advance - position.chars_read_total += 4; - position.chars_read_current_line += 4; current = char_traits::to_int_type(raw[3]); out = codepoint; return true; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ed8b262af..5780d57f0 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -11072,9 +11072,9 @@ class lexer : public lexer_base /// contiguous input: try to decode the 4 hex digits following `\\u` /// directly from the input buffer via hex_codepoint(), instead of 4 calls - /// to get(). On success, advances the adapter and the position counters - /// exactly as those 4 get() calls would (a hex digit is never '\n', so - /// only the flat counters move) and leaves @a current holding the last of + /// to get(). On success, advances the adapter exactly as those 4 get() + /// calls would (bulk_scan implies lazy_position, so there are no position + /// counters to advance) and leaves @a current holding the last of /// the 4 digits, just as the last such get() would; the codepoint is /// written to @a out. Makes no state change and returns false - for a /// pending unget, fewer than 4 remaining bytes, or any of the 4 bytes not @@ -11094,9 +11094,6 @@ class lexer : public lexer_base return false; } ia.bulk_skip(4); - // a hex digit is never a newline, so only the flat counters advance - position.chars_read_total += 4; - position.chars_read_current_line += 4; current = char_traits::to_int_type(raw[3]); out = codepoint; return true;