[vlc-devel] [PATCH] compat: tfind: fix prototype

Alexandre Janniaux ajanni at videolabs.io
Sun May 10 12:33:41 CEST 2020


Use prototype from tsearch(3), fixes the following warning when
targetin Android arm API 17.

../../src/misc/variables.c:154:32: warning: passing 'void **' to
parameter of type 'const void **' discards qualifiers in nested
pointer types [-Wincompatible-pointer-types-discards-qualifiers]

    pp_var = tfind( &psz_name, &priv->var_root, varcmp );
                               ^~~~~~~~~~~~~~~
---
 compat/tfind.c       | 2 +-
 include/vlc_fixups.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compat/tfind.c b/compat/tfind.c
index 804ecb8e435..743fa67513c 100644
--- a/compat/tfind.c
+++ b/compat/tfind.c
@@ -132,7 +132,7 @@ tdestroy(vrootp, freefct)
 void *
 tfind(vkey, vrootp, compar)
 	const void *vkey;		/* key to be found */
-	const void **vrootp;		/* address of the tree root */
+	void * const *vrootp;		/* address of the tree root */
 	int (*compar) (const void *, const void *);
 {
 	node_t * const *rootp = (node_t * const*)vrootp;
diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
index b875b03a0cc..925a1b62609 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -495,7 +495,7 @@ typedef enum {
 } VISIT;
 
 void *tsearch( const void *key, void **rootp, int(*cmp)(const void *, const void *) );
-void *tfind( const void *key, const void **rootp, int(*cmp)(const void *, const void *) );
+void *tfind( const void *key, void * const *rootp, int(*cmp)(const void *, const void *) );
 void *tdelete( const void *key, void **rootp, int(*cmp)(const void *, const void *) );
 void twalk( const void *root, void(*action)(const void *nodep, VISIT which, int depth) );
 void *lfind( const void *key, const void *base, size_t *nmemb,
-- 
2.26.2



More information about the vlc-devel mailing list