diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-02-25 14:18:56 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-02-25 14:18:56 +0100 |
commit | 860b3b6f155b45481b5bab9acd1397b04a73e707 (patch) | |
tree | bc29bf323ae1447c2811dbf0f1d2273fa1572f3d | |
parent | 67376bd706014617d2a399fb3b716e59ddc74ea9 (diff) | |
download | libgpiod-860b3b6f155b45481b5bab9acd1397b04a73e707.tar.gz |
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 <bartekgola@gmail.com>
-rw-r--r-- | bindings/cxx/chip.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/bindings/cxx/chip.cpp b/bindings/cxx/chip.cpp index c0204989..7d4d80be 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 |