From 16f7b263fd56db924ade2232fee7ac3490e00a3d Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 21 Sep 2026 11:12:09 +0000 Subject: [PATCH] docs: Correct three comments about null-terminated views (#8253) Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com> --- include/xrpl/basics/base_uint.h | 2 +- src/test/basics/PerfLog_test.cpp | 5 +++-- src/xrpld/perflog/detail/PerfLogImp.h | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/xrpl/basics/base_uint.h b/include/xrpl/basics/base_uint.h index bee8b8b945..3786f28c6a 100644 --- a/include/xrpl/basics/base_uint.h +++ b/include/xrpl/basics/base_uint.h @@ -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 diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index 0896de8eee..5e790810f7 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -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() { diff --git a/src/xrpld/perflog/detail/PerfLogImp.h b/src/xrpld/perflog/detail/PerfLogImp.h index ad1f98e356..bb1eb904de 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.h +++ b/src/xrpld/perflog/detail/PerfLogImp.h @@ -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> 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 methods; mutable std::mutex methodsMutex; - Counters(std::span labels, JobTypes const& jobTypes); + Counters(std::span methodNames, JobTypes const& jobTypes); json::Value countersJson() const; json::Value