Skip to contentSkip to conversation

gpiosim: use twalk() instead of twalk_r()

PATCH New Bartosz Golaszewski 1 participant 1 message Feb 13, 2023 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiosim: use twalk() instead of twalk_r()

From: Bartosz Golaszewski <[email protected]>

twalk_r() is a GNU extension for the binary search tree API. Musl libc doesn't provide it and after inquiring with the maintainer it turned out it won't provide it anytime soon as musl strives to only implement well standardized functions.

In order to not limit building libgpiosim and tests to glibc only, let's replace twalk_r() with twalk() and use global variables for the state. It's not a big deal as we're already using a global root node and a mutex to protect it.

---
 configure.ac            |  2 +-
 tests/gpiosim/gpiosim.c | 54 +++++++++++++++++++----------------------
 2 files changed, 26 insertions(+), 30 deletions(-)
configure.ac +1 -1
index 2bd71b0..d42b089 100644
@@ -162,7 +162,7 @@ then
 	AC_CHECK_FUNC([openat], [], [FUNC_NOT_FOUND_LIB([openat])])
 	AC_CHECK_FUNC([mkdirat], [], [FUNC_NOT_FOUND_LIB([mkdirat])])
 	AC_CHECK_FUNC([write], [], [FUNC_NOT_FOUND_LIB([write])])
-	AC_CHECK_FUNC([twalk_r], [], [FUNC_NOT_FOUND_LIB([twalk_r])])
+	AC_CHECK_FUNC([twalk], [], [FUNC_NOT_FOUND_LIB([twalk])])
 	AC_CHECK_FUNC([tsearch], [], [FUNC_NOT_FOUND_LIB([tsearch])])
 	AC_CHECK_FUNC([tdestroy], [], [FUNC_NOT_FOUND_LIB([tdestroy])])
 	AC_CHECK_FUNC([tdelete], [], [FUNC_NOT_FOUND_LIB([tdelete])])
tests/gpiosim/gpiosim.c +25 -29

128 lines not on this page · raw message

Signature · 1 line
2.37.2