From: Bartosz Golaszewski Date: Fri, 24 Feb 2017 11:18:54 +0000 (+0100) Subject: tests: add new cleanup helper X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bd63b9f26f51d7165841eb611b19b5568b921ee5;p=qemu-gpiodev%2Flibgpiod.git tests: add new cleanup helper Add gu_free_chip_iter_noclose() which calls gpiod_chip_iter_free_noclose() internally to free the chip iterator without closing the most recent chip handle. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/unit/gpiod-unit.c b/tests/unit/gpiod-unit.c index b6474e4..0f3dba0 100644 --- a/tests/unit/gpiod-unit.c +++ b/tests/unit/gpiod-unit.c @@ -402,6 +402,12 @@ void gu_free_chip_iter(struct gpiod_chip_iter **iter) gpiod_chip_iter_free(*iter); } +void gu_free_chip_iter_noclose(struct gpiod_chip_iter **iter) +{ + if (*iter) + gpiod_chip_iter_free_noclose(*iter); +} + void gu_release_line(struct gpiod_line **line) { if (*line) diff --git a/tests/unit/gpiod-unit.h b/tests/unit/gpiod-unit.h index c9b8c4c..efbd167 100644 --- a/tests/unit/gpiod-unit.h +++ b/tests/unit/gpiod-unit.h @@ -76,6 +76,7 @@ unsigned int gu_chip_num(unsigned int index); void gu_close_chip(struct gpiod_chip **chip); void gu_free_str(char **str); void gu_free_chip_iter(struct gpiod_chip_iter **iter); +void gu_free_chip_iter_noclose(struct gpiod_chip_iter **iter); void gu_release_line(struct gpiod_line **line); #define GU_ASSERT(statement) \