From: Andre Noll Date: Wed, 21 Jun 2023 21:06:09 +0000 (+0200) Subject: build: Remove AUDIOD_AUDIO_FORMATS_ENUM. X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a2568a74ee648390703dd8c8001b2ca09d0745b6;p=paraslash.git build: Remove AUDIOD_AUDIO_FORMATS_ENUM. 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. --- diff --git a/audiod.c b/audiod.c index 7c223995..0fae454c 100644 --- 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 { diff --git a/audiod.h b/audiod.h index 39beda1b..d5a9da65 100644 --- 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 */ diff --git a/configure.ac b/configure.ac index 3b042aca..b5e71e32 100644 --- a/configure.ac +++ b/configure.ac @@ -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