]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
build: Remove AUDIOD_AUDIO_FORMATS_ENUM.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 21 Jun 2023 21:06:09 +0000 (23:06 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 17 Mar 2024 11:34:49 +0000 (12:34 +0100)
No code actually refers to the AUDIO_FORMAT_$FOO values of this
enumeration. Its only purpose is to define the number of supported
audio formats (as the last constant of the enum). We may as well
employ ARRAY_SIZE() for that, so kill the enum and remove the loop
from configure.ac which generates it.

The related audio_formats array, which contains the names of the
supported audio formats, is only used in audiod.c, so we can remove
the declaration from audiod.h and make it static.

audiod.c
audiod.h
configure.ac

index 7c223995a9a29cec3c8e8ae5497c3be58655f63c..0fae454c51708a5db51a2833e1fa5fc74d0b72a2 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -46,8 +46,9 @@ static struct lls_parse_result *lpr;
 #define OPT_UINT32_VAL(_name) (lls_uint32_val(0, OPT_RESULT(_name)))
 
 __printf_2_3 void (*para_log)(int, const char*, ...) = daemon_log;
-/** define the array containing all supported audio formats */
-const char *audio_formats[] = {AUDIOD_AUDIO_FORMAT_ARRAY NULL};
+/* Audio formats supported by audiod */
+static const char *audio_formats[] = {AUDIOD_AUDIO_FORMAT_ARRAY};
+#define NUM_AUDIO_FORMATS ARRAY_SIZE(audio_formats)
 
 /** Defines how audiod handles one supported audio format. */
 struct audio_format_info {
index 39beda1bd4223d145fb327f07be4c5e5d4845d94..d5a9da65fde12fb303ddf55958f46a8cff124f12 100644 (file)
--- a/audiod.h
+++ b/audiod.h
@@ -2,13 +2,6 @@
 
 /** \file audiod.h Symbols exported from audiod.c. */
 
-
-/** enum of audio formats supported by para_audiod */
-enum {AUDIOD_AUDIO_FORMATS_ENUM};
-
-/** array of audio format names supported by para_audiod */
-extern const char *audio_formats[];
-
 extern int audiod_status;
 
 /* defined in audiod.c */
index 3b042aca136068af0a3228166fc135a690507e73..b5e71e3253defc6b3ba417d5b1040c30929ea678 100644 (file)
@@ -574,9 +574,6 @@ if test -n "$CRYPTOLIB"; then
        fi
        AC_SUBST(audiod_objs, add_dot_o($audiod_objs))
 
-       enum="$(for i in $audiod_audio_formats; do printf "AUDIO_FORMAT_${i}, " | tr '[a-z]' '[A-Z]'; done)"
-       AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMATS_ENUM, $enum NUM_AUDIO_FORMATS,
-               enum of audio formats supported by audiod)
        names="$(for i in $audiod_audio_formats; do printf \"$i\",' ' ; done)"
        AC_DEFINE_UNQUOTED(AUDIOD_AUDIO_FORMAT_ARRAY, $names, array of audio formats supported by audiod)
 else