mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
[xswiftbus] Use std::string_view for performance in CDBusMessage
This avoids repeated dynamic memory allocations in dbusMessageHandler methods and elsewhere due to repeatedly constructing temporary strings. std::string_view is a C++17 feature but also part of the Library Fundamentals TS and available in all our compilers.
This commit is contained in:
@@ -61,17 +61,17 @@ namespace XSwiftBus
|
||||
return dbus_message_get_serial(m_message);
|
||||
}
|
||||
|
||||
std::string CDBusMessage::getInterfaceName() const
|
||||
string_view CDBusMessage::getInterfaceName() const
|
||||
{
|
||||
return dbus_message_get_interface(m_message);
|
||||
}
|
||||
|
||||
std::string CDBusMessage::getObjectPath() const
|
||||
string_view CDBusMessage::getObjectPath() const
|
||||
{
|
||||
return dbus_message_get_path(m_message);
|
||||
}
|
||||
|
||||
std::string CDBusMessage::getMethodName() const
|
||||
string_view CDBusMessage::getMethodName() const
|
||||
{
|
||||
return dbus_message_get_member(m_message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user