Files
scylladb/utils/ascii.hh
Kefu Chai 7215d4bfe9 utils: do not include unused headers
these unused includes were identifier by clang-include-cleaner. after
auditing these source files, all of the reports have been confirmed.

please note, because quite a few source files relied on
`utils/to_string.hh` to pull in the specialization of
`fmt::formatter<std::optional<T>>`, after removing
`#include <fmt/std.h>` from `utils/to_string.hh`, we have to
include `fmt/std.h` directly.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2025-01-14 07:56:39 -05:00

32 lines
535 B
C++

/*
* Optimized ASCII string validation.
*
* Copyright (c) 2018, Arm Limited.
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#pragma once
#include <cstdint>
#include "bytes_fwd.hh"
namespace utils {
namespace ascii {
bool validate(const uint8_t *data, size_t len);
inline bool validate(bytes_view string) {
const uint8_t *data = reinterpret_cast<const uint8_t*>(string.data());
size_t len = string.size();
return validate(data, len);
}
} // namespace ascii
} // namespace utils