Skip to content

Commit 65148b1

Browse files
committed
Put anonymous namespace in front of everything
1 parent 2f92a34 commit 65148b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+188
-41
lines changed

src/arm64/bitmanipulation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace simdjson {
55
namespace arm64 {
6+
namespace {
67

78
// We sometimes call trailing_zero on inputs that are zero,
89
// but the algorithms do not end up using the returned value.
@@ -64,6 +65,7 @@ really_inline bool mul_overflow(uint64_t value1, uint64_t value2, uint64_t *resu
6465
#endif
6566
}
6667

68+
} // namespace {
6769
} // namespace arm64
6870
} // namespace simdjson
6971

src/arm64/bitmask.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace simdjson {
55
namespace arm64 {
6+
namespace {
67

78
//
89
// Perform a "cumulative bitwise xor," flipping bits each time a 1 is encountered.

src/arm64/dom_parser_implementation.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ really_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2, c
9898
return is_third_byte ^ is_fourth_byte;
9999
}
100100

101+
} // namespace {
101102
} // namespace SIMDJSON_IMPLEMENTATION
102103
} // namespace simdjson
103104

@@ -120,6 +121,7 @@ namespace simdjson {
120121
namespace SIMDJSON_IMPLEMENTATION {
121122

122123
namespace stage1 {
124+
namespace {
123125

124126
really_inline uint64_t json_string_scanner::find_escaped(uint64_t backslash) {
125127
// On ARM, we don't short-circuit this if there are no backslashes, because the branch gives us no
@@ -128,6 +130,7 @@ really_inline uint64_t json_string_scanner::find_escaped(uint64_t backslash) {
128130
return find_escaped_branchless(backslash);
129131
}
130132

133+
} // namespace {
131134
} // namespace stage1
132135

133136
WARN_UNUSED error_code implementation::minify(const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept {
@@ -144,6 +147,23 @@ WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) cons
144147
return simdjson::arm64::stage1::generic_validate_utf8(buf,len);
145148
}
146149

150+
WARN_UNUSED error_code dom_parser_implementation::stage2(dom::document &_doc) noexcept {
151+
error_code result = stage2::parse_structurals<false>(*this, _doc);
152+
if (result) { return result; }
153+
154+
// If we didn't make it to the end, it's an error
155+
if ( next_structural_index != n_structural_indexes ) {
156+
logger::log_string("More than one JSON value at the root of the document, or extra characters at the end of the JSON!");
157+
return error = TAPE_ERROR;
158+
}
159+
160+
return SUCCESS;
161+
}
162+
163+
WARN_UNUSED error_code dom_parser_implementation::stage2_next(dom::document &_doc) noexcept {
164+
return stage2::parse_structurals<true>(*this, _doc);
165+
}
166+
147167
WARN_UNUSED error_code dom_parser_implementation::parse(const uint8_t *_buf, size_t _len, dom::document &_doc) noexcept {
148168
error_code err = stage1(_buf, _len, false);
149169
if (err) { return err; }

src/arm64/implementation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace simdjson {
55
namespace SIMDJSON_IMPLEMENTATION {
6+
namespace {
67

78
WARN_UNUSED error_code implementation::create_dom_parser_implementation(
89
size_t capacity,
@@ -16,6 +17,7 @@ WARN_UNUSED error_code implementation::create_dom_parser_implementation(
1617
return SUCCESS;
1718
}
1819

20+
} // namespace {
1921
} // namespace SIMDJSON_IMPLEMENTATION
2022
} // namespace simdjson
2123

src/arm64/implementation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace simdjson {
88
namespace arm64 {
9+
namespace {
910

1011
using namespace simdjson::dom;
1112

@@ -21,6 +22,7 @@ class implementation final : public simdjson::implementation {
2122
WARN_UNUSED bool validate_utf8(const char *buf, size_t len) const noexcept final;
2223
};
2324

25+
} // namespace {
2426
} // namespace arm64
2527
} // namespace simdjson
2628

src/arm64/numberparsing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace simdjson {
55
namespace arm64 {
6+
namespace {
67

78
// we don't have SSE, so let us use a scalar function
89
// credit: https://johnnylee-sde.github.io/Fast-numeric-string-to-int/
@@ -14,6 +15,7 @@ static really_inline uint32_t parse_eight_digits_unrolled(const uint8_t *chars)
1415
return uint32_t((val & 0x0000FFFF0000FFFF) * 42949672960001 >> 32);
1516
}
1617

18+
} // namespace {
1719
} // namespace arm64
1820
} // namespace simdjson
1921

src/arm64/simd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace simdjson {
1111
namespace arm64 {
12+
namespace {
1213
namespace simd {
1314

1415
#ifdef SIMDJSON_REGULAR_VISUAL_STUDIO
@@ -494,6 +495,7 @@ really_inline int8x16_t make_int8x16_t(int8_t x1, int8_t x2, int8_t x3, int8_
494495
}; // struct simd8x64<T>
495496

496497
} // namespace simd
498+
} // namespace {
497499
} // namespace arm64
498500
} // namespace simdjson
499501

src/arm64/stringparsing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace simdjson {
99
namespace arm64 {
10+
namespace {
1011

1112
using namespace simd;
1213

@@ -43,6 +44,7 @@ really_inline backslash_and_quote backslash_and_quote::copy_and_find(const uint8
4344
};
4445
}
4546

47+
} // namespace {
4648
} // namespace arm64
4749
} // namespace simdjson
4850

src/fallback/bitmanipulation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace simdjson {
88
namespace fallback {
9+
namespace {
910

1011
#if defined(_MSC_VER) && !defined(_M_ARM64) && !defined(_M_X64)
1112
static inline unsigned char _BitScanForward64(unsigned long* ret, uint64_t x) {
@@ -71,6 +72,7 @@ really_inline bool mul_overflow(uint64_t value1, uint64_t value2, uint64_t *resu
7172
return value2 > 0 && value1 > std::numeric_limits<uint64_t>::max() / value2;
7273
}
7374

75+
} // namespace {
7476
} // namespace fallback
7577
} // namespace simdjson
7678

src/fallback/dom_parser_implementation.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace simdjson {
1111
namespace SIMDJSON_IMPLEMENTATION {
12+
namespace {
1213
namespace stage1 {
1314

1415
class structural_scanner {
@@ -307,6 +308,7 @@ WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) cons
307308
return true;
308309
}
309310

311+
} // namespace {
310312
} // namespace SIMDJSON_IMPLEMENTATION
311313
} // namespace simdjson
312314

@@ -320,6 +322,23 @@ WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) cons
320322
namespace simdjson {
321323
namespace SIMDJSON_IMPLEMENTATION {
322324

325+
WARN_UNUSED error_code dom_parser_implementation::stage2(dom::document &_doc) noexcept {
326+
error_code result = stage2::parse_structurals<false>(*this, _doc);
327+
if (result) { return result; }
328+
329+
// If we didn't make it to the end, it's an error
330+
if ( next_structural_index != n_structural_indexes ) {
331+
logger::log_string("More than one JSON value at the root of the document, or extra characters at the end of the JSON!");
332+
return error = TAPE_ERROR;
333+
}
334+
335+
return SUCCESS;
336+
}
337+
338+
WARN_UNUSED error_code dom_parser_implementation::stage2_next(dom::document &_doc) noexcept {
339+
return stage2::parse_structurals<true>(*this, _doc);
340+
}
341+
323342
WARN_UNUSED error_code dom_parser_implementation::parse(const uint8_t *_buf, size_t _len, dom::document &_doc) noexcept {
324343
error_code err = stage1(_buf, _len, false);
325344
if (err) { return err; }

0 commit comments

Comments
 (0)