std::string result = "/";
const size_t npos = string_view::npos;
size_t left = 1;
- size_t right = 1;
while (true) {
if (left >= path.length()) {
break;
}
- right = path.find('/', left);
+ const auto right = path.find('/', left);
string_view part = path.substr(left, right == npos ? npos : right - left);
if (part == "..") {
if (result.length() > 1) {
{
// This object is placed onto the heap so it is available in exit functions
// which run after main(). It is cleaned up by the last exit function.
- Context* ctx = new Context{};
+ Context* ctx = new Context;
set_up_config(ctx->config);
char* result = x_strdup("");
const char* p = str; // Interval start.
const char* q = str; // Interval end.
- for (q = str; *q; ++q) {
+ for (; *q; ++q) {
if (*q == '$') {
reformat(&result, "%s%.*s", result, (int)(q - p), p);
if (!expand_variable(&q, &result, errmsg)) {
void
stats_flush(void* context)
{
- Context& ctx = *static_cast<Context*>(context);
+ const Context& ctx = *static_cast<Context*>(context);
stats_flush_to_file(ctx.config, ctx.stats_file, ctx.counter_updates);
}