SolidWallOfCode commented on code in PR #10069:
URL: https://github.com/apache/trafficserver/pull/10069#discussion_r1275341867
##########
plugins/experimental/remap_stats/remap_stats.cc:
##########
@@ -141,11 +141,11 @@ handle_post_remap(TSCont cont, TSEvent event ATS_UNUSED,
void *edata)
}
void
-create_stat_name(ts::FixedBufferWriter &stat_name, std::string_view const h,
std::string_view const b)
+create_stat_name(swoc::FixedBufferWriter &stat_name, std::string_view const h,
std::string_view const b)
{
- stat_name.reset().clip(1);
+ stat_name.clear().restrict(1);
Review Comment:
It adjusts the capacity temporarily. `restrict(1)` decreases the capacity by
one, so that there is a byte in reserve. This is useful when specific terminal
characters are required (in this case, I think it's a terminal nul). The
intermediate data can be written, and the the capacity `restore`'d so the
terminal nul can always be written to the buffer. I'm considering an alternate
mechanism (which solves a different major issue).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]