Merge "liblp: convert more functions to use string_view"
am: 09963adb21
Change-Id: Iaf3e878281c608e6e40fdd4a106baca625c9d949
This commit is contained in:
commit
cfeb33bca8
2 changed files with 9 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ bool ZeroExtent::AddTo(LpMetadata* out) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
Partition::Partition(const std::string& name, const std::string& group_name, uint32_t attributes)
|
||||
Partition::Partition(std::string_view name, std::string_view group_name, uint32_t attributes)
|
||||
: name_(name), group_name_(group_name), attributes_(attributes), size_(0) {}
|
||||
|
||||
void Partition::AddExtent(std::unique_ptr<Extent>&& extent) {
|
||||
|
|
@ -436,10 +436,10 @@ bool MetadataBuilder::AddGroup(const std::string& group_name, uint64_t maximum_s
|
|||
}
|
||||
|
||||
Partition* MetadataBuilder::AddPartition(const std::string& name, uint32_t attributes) {
|
||||
return AddPartition(name, std::string(kDefaultGroup), attributes);
|
||||
return AddPartition(name, kDefaultGroup, attributes);
|
||||
}
|
||||
|
||||
Partition* MetadataBuilder::AddPartition(const std::string& name, const std::string& group_name,
|
||||
Partition* MetadataBuilder::AddPartition(std::string_view name, std::string_view group_name,
|
||||
uint32_t attributes) {
|
||||
if (name.empty()) {
|
||||
LERROR << "Partition must have a non-empty name.";
|
||||
|
|
@ -457,7 +457,7 @@ Partition* MetadataBuilder::AddPartition(const std::string& name, const std::str
|
|||
return partitions_.back().get();
|
||||
}
|
||||
|
||||
Partition* MetadataBuilder::FindPartition(const std::string& name) {
|
||||
Partition* MetadataBuilder::FindPartition(std::string_view name) {
|
||||
for (const auto& partition : partitions_) {
|
||||
if (partition->name() == name) {
|
||||
return partition.get();
|
||||
|
|
@ -958,7 +958,7 @@ std::vector<std::string> MetadataBuilder::ListGroups() const {
|
|||
return names;
|
||||
}
|
||||
|
||||
void MetadataBuilder::RemoveGroupAndPartitions(const std::string& group_name) {
|
||||
void MetadataBuilder::RemoveGroupAndPartitions(std::string_view group_name) {
|
||||
if (group_name == kDefaultGroup) {
|
||||
// Cannot remove the default group.
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class Partition final {
|
|||
friend class MetadataBuilder;
|
||||
|
||||
public:
|
||||
Partition(const std::string& name, const std::string& group_name, uint32_t attributes);
|
||||
Partition(std::string_view name, std::string_view group_name, uint32_t attributes);
|
||||
|
||||
// Add a raw extent.
|
||||
void AddExtent(std::unique_ptr<Extent>&& extent);
|
||||
|
|
@ -214,7 +214,7 @@ class MetadataBuilder {
|
|||
|
||||
// Add a partition, returning a handle so it can be sized as needed. If a
|
||||
// partition with the given name already exists, nullptr is returned.
|
||||
Partition* AddPartition(const std::string& name, const std::string& group_name,
|
||||
Partition* AddPartition(std::string_view name, std::string_view group_name,
|
||||
uint32_t attributes);
|
||||
|
||||
// Same as AddPartition above, but uses the default partition group which
|
||||
|
|
@ -225,7 +225,7 @@ class MetadataBuilder {
|
|||
void RemovePartition(const std::string& name);
|
||||
|
||||
// Find a partition by name. If no partition is found, nullptr is returned.
|
||||
Partition* FindPartition(const std::string& name);
|
||||
Partition* FindPartition(std::string_view name);
|
||||
|
||||
// Find a group by name. If no group is found, nullptr is returned.
|
||||
PartitionGroup* FindGroup(std::string_view name);
|
||||
|
|
@ -269,7 +269,7 @@ class MetadataBuilder {
|
|||
std::vector<std::string> ListGroups() const;
|
||||
|
||||
// Remove all partitions belonging to a group, then remove the group.
|
||||
void RemoveGroupAndPartitions(const std::string& group_name);
|
||||
void RemoveGroupAndPartitions(std::string_view group_name);
|
||||
|
||||
// Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag.
|
||||
void SetAutoSlotSuffixing();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue