The core library guarantees that a GPIO chip will have a name and
a label. No need to check if the returned strings are empty.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
{
this->throw_if_noref();
- const char* name = ::gpiod_chip_name(this->_m_chip.get());
-
- return ::std::move(name ? ::std::string(name) : ::std::string());
+ return ::std::move(::std::string(::gpiod_chip_name(this->_m_chip.get())));
}
::std::string chip::label(void) const
{
this->throw_if_noref();
- const char* label = ::gpiod_chip_label(this->_m_chip.get());
-
- return ::std::move(label ? ::std::string(label) : ::std::string());
+ return ::std::move(::std::string(::gpiod_chip_label(this->_m_chip.get())));
}
unsigned int chip::num_lines(void) const