[vlc-commits] compat: tfind: fix prototype

Alexandre Janniaux git at videolan.org
Tue Jun 30 12:00:06 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sun May 10 12:33:41 2020 +0200| [e1c1eac150f208e6e06c80bca369d5840c3565ec] | committer: Alexandre Janniaux

compat: tfind: fix prototype

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 );
                               ^~~~~~~~~~~~~~~

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1c1eac150f208e6e06c80bca369d5840c3565ec
---

 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 804ecb8e43..743fa67513 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 17fa3ed09a..15ebb0bd20 100644
--- a/include/vlc_fixups.h
+++ b/include/vlc_fixups.h
@@ -497,7 +497,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,



More information about the vlc-commits mailing list