iter: rework line iterator API
authorBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 19:57:25 +0000 (20:57 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Sun, 5 Nov 2017 19:57:25 +0000 (20:57 +0100)
commitdfe98084e2641d49eed7d8d5203089031a819632
treefde5e85901d9d4a570174d9909a7478c1eb7ba56
parent1039b1cfb40ac73273a9a78b0a585048f7179dcf
iter: rework line iterator API

The changes roughly correspond with what we did for chip iterators.

Only perform operations that can fail in gpiod_line_iter_new(), so
that there's no need to check for errors after every call to
gpiod_line_iter_next().

Make gpiod_line_iter an opaque pointer and provide 'new' and 'free'
functions.

Update all users and relevant test cases. Extend the test API with
a new cleanup function.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
include/gpiod.h
src/lib/helpers.c
src/lib/iter.c
src/tools/gpioinfo.c
tests/gpiod-test.c
tests/gpiod-test.h
tests/tests-iter.c