docs: Correct three comments about null-terminated views (#8253)

Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
This commit is contained in:
Bart
2026-09-21 11:12:09 +00:00
committed by GitHub
parent f6b51f0b8b
commit 16f7b263fd
3 changed files with 8 additions and 7 deletions

View File

@@ -518,7 +518,7 @@ public:
* The input must be precisely `2 * bytes` hexadecimal characters
* long, with one exception: the value '0'.
*
* @param sv A null-terminated string of hexadecimal characters
* @param sv A string of hexadecimal characters
* @return true if the input was parsed properly; false otherwise.
*/
[[nodiscard]] constexpr bool

View File

@@ -1032,8 +1032,9 @@ public:
// makePerfLog() copies the range of names it is given, so only the names have
// to outlive the PerfLog. Here the range does not: it is destroyed before the
// counters are read. Retaining it instead is a use-after-free that a
// sanitizer build reports and this test would otherwise pass through.
// counters are read. Retaining it instead is a use-after-free, which a
// sanitizer build reports directly and which otherwise surfaces as a failed
// assertion or a Debug-mode heap-corruption abort, not a silent pass.
void
testCallerRangeNeedNotOutlive()
{

View File

@@ -93,9 +93,9 @@ class PerfLogImp : public PerfLog
// rpc and jq do not need mutex protection because all
// keys and values are created before more threads are started.
//
// Every key views the characters of a name in labels below, which the caller
// guarantees outlive this object, so the map copies no name to store one and
// needs no string to look one up.
// Every key views the characters of a name from the methodNames constructor
// parameter below, which the caller guarantees outlive this object, so the
// map copies no name to store one and needs no string to look one up.
std::unordered_map<std::string_view, Locked<Rpc>> rpc;
// The same names, in the order the caller gave them, and still carrying the
@@ -112,7 +112,7 @@ class PerfLogImp : public PerfLog
std::unordered_map<std::uint64_t, MethodStart> methods;
mutable std::mutex methodsMutex;
Counters(std::span<NullTerminatedView const> labels, JobTypes const& jobTypes);
Counters(std::span<NullTerminatedView const> methodNames, JobTypes const& jobTypes);
json::Value
countersJson() const;
json::Value