|
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
9 | 9 | #include "error_to_string.h" |
10 | | -#include "platform_errors.h" |
11 | 10 |
|
| 11 | +#include <stddef.h> |
| 12 | + |
| 13 | +#include "platform_errors.h" |
12 | 14 | #include "src/__support/CPP/span.h" |
13 | 15 | #include "src/__support/CPP/string_view.h" |
14 | 16 | #include "src/__support/CPP/stringstream.h" |
|
17 | 19 | #include "src/__support/macros/attributes.h" |
18 | 20 | #include "src/__support/macros/config.h" |
19 | 21 |
|
20 | | -#include <stddef.h> |
21 | | - |
22 | 22 | namespace LIBC_NAMESPACE_DECL { |
23 | | -namespace internal { |
| 23 | +namespace { |
24 | 24 |
|
25 | 25 | constexpr size_t max_buff_size() { |
26 | 26 | constexpr size_t unknown_str_len = sizeof("Unknown error"); |
@@ -63,23 +63,22 @@ cpp::string_view build_error_string(int err_num, cpp::span<char> buffer) { |
63 | 63 | return buffer_stream.str(); |
64 | 64 | } |
65 | 65 |
|
66 | | -} // namespace internal |
| 66 | +} // namespace |
67 | 67 |
|
68 | 68 | cpp::string_view get_error_string(int err_num) { |
69 | | - return get_error_string(err_num, |
70 | | - {internal::error_buffer, internal::ERR_BUFFER_SIZE}); |
| 69 | + return get_error_string(err_num, {error_buffer, ERR_BUFFER_SIZE}); |
71 | 70 | } |
72 | 71 |
|
73 | 72 | cpp::string_view get_error_string(int err_num, cpp::span<char> buffer) { |
74 | | - auto opt_str = internal::ERROR_MAPPER.get_str(err_num); |
| 73 | + auto opt_str = ERROR_MAPPER.get_str(err_num); |
75 | 74 | if (opt_str) |
76 | 75 | return *opt_str; |
77 | 76 | else |
78 | | - return internal::build_error_string(err_num, buffer); |
| 77 | + return build_error_string(err_num, buffer); |
79 | 78 | } |
80 | 79 |
|
81 | 80 | cpp::optional<cpp::string_view> try_get_errno_name(int err_num) { |
82 | | - return internal::ERRNO_NAME_MAPPER.get_str(err_num); |
| 81 | + return ERRNO_NAME_MAPPER.get_str(err_num); |
83 | 82 | } |
84 | 83 |
|
85 | 84 | } // namespace LIBC_NAMESPACE_DECL |
0 commit comments