include/CompatSet: use std::string_view in struct Feature

Almost all callers pass a C string (in temporary Feature instances),
only `CompatSetHandler::handle()` passes a `std::string` reference.

Allocating a new `std::string` is useless overhead.  This patch
reduces the binary size by 21 kB.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
This commit is contained in:
Max Kellermann 2024-10-16 19:53:20 +02:00
parent 8023e9f5df
commit 5a45cd213e

View File

@ -29,9 +29,9 @@ struct CompatSet {
struct Feature {
uint64_t id;
std::string name;
std::string_view name;
Feature(uint64_t _id, const std::string& _name) : id(_id), name(_name) {}
constexpr Feature(uint64_t _id, const std::string_view _name) : id(_id), name(_name) {}
};
class FeatureSet {