1From 4a4b059a25abbcbfeb8593cdeb3098c2bd19011a Mon Sep 17 00:00:00 2001
2From: Michael Forney <mforney@mforney.org>
3Date: Sat, 16 Mar 2024 20:02:10 -0700
4Subject: [PATCH] Prevent unused definitions in some configurations
5
6---
7 src/dlmisc.c | 12 ++++++------
8 src/pcm/pcm_rate.c | 2 ++
9 2 files changed, 8 insertions(+), 6 deletions(-)
10
11diff --git a/src/dlmisc.c b/src/dlmisc.c
12index 96784197..a1ab77c2 100644
13--- a/src/dlmisc.c
14+++ b/src/dlmisc.c
15@@ -196,6 +196,8 @@ int snd_dlclose(void *handle)
16 #endif
17 }
18
19+#ifdef HAVE_LIBDL
20+#ifdef VERSIONED_SYMBOLS
21 /**
22 * \brief Verifies a dynamically loaded symbol.
23 * \param handle Library handle, similar to \c dlsym.
24@@ -208,7 +210,6 @@ int snd_dlclose(void *handle)
25 */
26 static int snd_dlsym_verify(void *handle, const char *name, const char *version)
27 {
28-#ifdef HAVE_LIBDL
29 int res;
30 char *vname;
31
32@@ -225,10 +226,9 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
33 if (res < 0)
34 SNDERR("unable to verify version for symbol %s", name);
35 return res;
36-#else
37- return 0;
38-#endif
39 }
40+#endif
41+#endif
42
43 /**
44 * \brief Resolves a symbol from a dynamic library - ALSA wrapper for \c dlsym.
45@@ -245,8 +245,6 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
46 */
47 void *snd_dlsym(void *handle, const char *name, const char *version)
48 {
49- int err;
50-
51 #ifndef PIC
52 if (handle == &snd_dlsym_start) {
53 /* it's the funny part: */
54@@ -262,6 +260,8 @@ void *snd_dlsym(void *handle, const char *name, const char *version)
55 #endif
56 #ifdef HAVE_LIBDL
57 #ifdef VERSIONED_SYMBOLS
58+ int err;
59+
60 if (version) {
61 err = snd_dlsym_verify(handle, name, version);
62 if (err < 0)
63diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
64index 5f0cc774..509b1b14 100644
65--- a/src/pcm/pcm_rate.c
66+++ b/src/pcm/pcm_rate.c
67@@ -1453,6 +1453,7 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf
68 }
69 #endif
70
71+#ifdef PIC
72 /*
73 * If the conf is an array of alternatives then the id of
74 * the first element will be "0" (or maybe NULL). Otherwise assume it is
75@@ -1477,6 +1478,7 @@ static int is_string_array(const snd_config_t *conf)
76
77 return 1;
78 }
79+#endif
80
81 /**
82 * \brief Creates a new rate PCM
83--
842.44.0
85