<div dir="ltr">It appears I missed a previous review on a similar patch, I apologize for the useless duplicate. Please ignore this patch.<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 8, 2018 at 12:29 PM Victorien Le Couviour--Tuffet <<a href="mailto:victorien.lecouviour.tuffet@gmail.com">victorien.lecouviour.tuffet@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This fixes android build with NDK 17 since tfind is always available but<br>
not twalk.<br>
---<br>
 compat/tfind.c | 49 +------------------------------------<br>
 compat/twalk.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++<br>
 <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a>   |  2 +-<br>
 3 files changed, 68 insertions(+), 49 deletions(-)<br>
 create mode 100644 compat/twalk.c<br>
<br>
diff --git a/compat/tfind.c b/compat/tfind.c<br>
index 804ecb8e43..abef9f44a6 100644<br>
--- a/compat/tfind.c<br>
+++ b/compat/tfind.c<br>
@@ -1,5 +1,5 @@<br>
 /*****************************************************************************<br>
- * tfind.c : implement every t* fuctions<br>
+ * tfind.c : implement every t* functions except twalk<br>
  *****************************************************************************/<br>
<br>
 #ifdef HAVE_CONFIG_H<br>
@@ -205,51 +205,4 @@ tsearch(vkey, vrootp, compar)<br>
        return q;<br>
 }<br>
<br>
-<br>
-/*     $NetBSD: twalk.c,v 1.2 1999/09/16 11:45:37 lukem Exp $  */<br>
-<br>
-/*<br>
- * Tree search generalized from Knuth (6.2.2) Algorithm T just like<br>
- * the AT&T man page says.<br>
- *<br>
- * The node_t structure is for internal use only, lint doesn't grok it.<br>
- *<br>
- * Written by reading the System V Interface Definition, not the code.<br>
- *<br>
- * Totally public domain.<br>
- */<br>
-<br>
-/* Walk the nodes of a tree */<br>
-static void<br>
-twalk_recurse(root, action, level)<br>
-       const node_t *root;     /* Root of the tree to be walked */<br>
-       void (*action) (const void *, VISIT, int);<br>
-       int level;<br>
-{<br>
-       assert(root != NULL);<br>
-       assert(action != NULL);<br>
-<br>
-       if (root->llink == NULL && root->rlink == NULL)<br>
-               (*action)(root, leaf, level);<br>
-       else {<br>
-               (*action)(root, preorder, level);<br>
-               if (root->llink != NULL)<br>
-                       twalk_recurse(root->llink, action, level + 1);<br>
-               (*action)(root, postorder, level);<br>
-               if (root->rlink != NULL)<br>
-                       twalk_recurse(root->rlink, action, level + 1);<br>
-               (*action)(root, endorder, level);<br>
-       }<br>
-}<br>
-<br>
-/* Walk the nodes of a tree */<br>
-void<br>
-twalk(vroot, action)<br>
-       const void *vroot;      /* Root of the tree to be walked */<br>
-       void (*action) (const void *, VISIT, int);<br>
-{<br>
-       if (vroot != NULL && action != NULL)<br>
-               twalk_recurse(vroot, action, 0);<br>
-}<br>
-<br>
 #endif // HAVE_SEARCH_H<br>
diff --git a/compat/twalk.c b/compat/twalk.c<br>
new file mode 100644<br>
index 0000000000..59486d7575<br>
--- /dev/null<br>
+++ b/compat/twalk.c<br>
@@ -0,0 +1,66 @@<br>
+/*****************************************************************************<br>
+ * twalk.c : implement twalk<br>
+ *****************************************************************************/<br>
+<br>
+#ifdef HAVE_CONFIG_H<br>
+# include <config.h><br>
+#endif<br>
+<br>
+/** search.h is not present so twalk has to be implemented */<br>
+#ifndef HAVE_SEARCH_H<br>
+<br>
+#include <assert.h><br>
+#include <stdlib.h><br>
+<br>
+typedef struct node {<br>
+    char         *key;<br>
+    struct node  *llink, *rlink;<br>
+} node_t;<br>
+<br>
+/*     $NetBSD: twalk.c,v 1.2 1999/09/16 11:45:37 lukem Exp $  */<br>
+<br>
+/*<br>
+ * Tree search generalized from Knuth (6.2.2) Algorithm T just like<br>
+ * the AT&T man page says.<br>
+ *<br>
+ * The node_t structure is for internal use only, lint doesn't grok it.<br>
+ *<br>
+ * Written by reading the System V Interface Definition, not the code.<br>
+ *<br>
+ * Totally public domain.<br>
+ */<br>
+<br>
+/* Walk the nodes of a tree */<br>
+static void<br>
+twalk_recurse(root, action, level)<br>
+       const node_t *root;     /* Root of the tree to be walked */<br>
+       void (*action) (const void *, VISIT, int);<br>
+       int level;<br>
+{<br>
+       assert(root != NULL);<br>
+       assert(action != NULL);<br>
+<br>
+       if (root->llink == NULL && root->rlink == NULL)<br>
+               (*action)(root, leaf, level);<br>
+       else {<br>
+               (*action)(root, preorder, level);<br>
+               if (root->llink != NULL)<br>
+                       twalk_recurse(root->llink, action, level + 1);<br>
+               (*action)(root, postorder, level);<br>
+               if (root->rlink != NULL)<br>
+                       twalk_recurse(root->rlink, action, level + 1);<br>
+               (*action)(root, endorder, level);<br>
+       }<br>
+}<br>
+<br>
+/* Walk the nodes of a tree */<br>
+void<br>
+twalk(vroot, action)<br>
+       const void *vroot;      /* Root of the tree to be walked */<br>
+       void (*action) (const void *, VISIT, int);<br>
+{<br>
+       if (vroot != NULL && action != NULL)<br>
+               twalk_recurse(vroot, action, 0);<br>
+}<br>
+<br>
+#endif /* HAVE_SEARCH_H */<br>
diff --git a/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 202f1fa624..f352de1138 100644<br>
--- a/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ b/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -581,7 +581,7 @@ need_libc=false<br>
<br>
 dnl Check for usual libc functions<br>
 AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale openat pipe2 pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale])<br>
-AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf])<br>
+AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get twalk strverscmp pathconf])<br>
 AC_REPLACE_FUNCS([gettimeofday])<br>
 AC_CHECK_FUNC(fdatasync,,<br>
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])<br>
-- <br>
2.19.1<br>
<br>
</blockquote></div>