0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd: Simplify w/ ::snprintf for mostly static init callpaths.

This commit is contained in:
Jason Volk 2022-05-19 15:25:21 -07:00
parent a10bc71fbf
commit ef32565d66
2 changed files with 16 additions and 9 deletions

View file

@ -496,17 +496,20 @@ ircd::conf::make_env_name(const mutable_buffer &buf,
const item<void> &item,
const string_view &feature)
{
thread_local char tmp[conf::NAME_MAX_LEN];
char tmp[conf::NAME_MAX_LEN] {0};
const auto name
{
make_env_name(tmp, item)
};
return fmt::sprintf
return string_view
{
buf, "%s__%s",
name,
feature,
data(buf), ::snprintf
(
data(buf), size(buf), "%s__%s",
name.c_str(),
feature.c_str()
)
};
}

View file

@ -344,11 +344,15 @@ ircd::string_view
ircd::ios::stats_name(const descriptor &d,
const string_view &key)
{
return fmt::sprintf
return string_view
{
stats_name_buf, "ircd.ios.%s.%s",
d.name,
key,
stats_name_buf, ::snprintf
(
stats_name_buf, sizeof(stats_name_buf),
"ircd.ios.%s.%s",
d.name.c_str(),
key.c_str()
)
};
}