From: Bartosz Golaszewski Date: Sun, 25 Feb 2018 13:18:56 +0000 (+0100) Subject: bindings: cxx: don't check the chip's label and name for empty strings X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=860b3b6f155b45481b5bab9acd1397b04a73e707;p=qemu-gpiodev%2Flibgpiod.git bindings: cxx: don't check the chip's label and name for empty strings 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 --- diff --git a/bindings/cxx/chip.cpp b/bindings/cxx/chip.cpp index c020498..7d4d80b 100644 --- a/bindings/cxx/chip.cpp +++ b/bindings/cxx/chip.cpp @@ -95,18 +95,14 @@ void chip::reset(void) noexcept { 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