iter: use scandir() for chip iterators
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 31 Oct 2017 15:00:21 +0000 (16:00 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Tue, 31 Oct 2017 15:10:05 +0000 (16:10 +0100)
commit643538eb560246757d8241ae3ff7d453ad6ff648
treeec67e9c656e212929455dbedbb1bd74e846c5e2d
parenta029549af5d2792762286536db09b2cf564dc7a7
iter: use scandir() for chip iterators

Using scandir() instead of opendir() allows us to scan for all
gpiochip devices already when creating the iterator. This simplifies
the code and doesn't require keeping the directory open when
iterating.

Storing the array of all found GPIO chips will also make it easier if
we ever want to implement a reverse iterator (e.g. for C++ bindings).

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
configure.ac
src/lib/iter.c