Skip to content

Commit 5f05203

Browse files
util: add ly_list_iter
Add a new function to go through a libyang list, equivalent to LY_LIST_FOR. Closes: CESNET#102 Signed-off-by: Stefan Gula <steweg@gmail.com> Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
1 parent fe0b3d0 commit 5f05203

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libyang/util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ def ly_array_iter(cdata):
5959
yield cdata[i]
6060

6161

62+
# -------------------------------------------------------------------------------------
63+
def ly_list_iter(cdata):
64+
item = cdata
65+
while item != ffi.NULL:
66+
yield item
67+
item = item.next
68+
69+
6270
# -------------------------------------------------------------------------------------
6371
class IOType(enum.Enum):
6472
FD = enum.auto()

0 commit comments

Comments
 (0)