From a1610c2bd6e3097c6473c5403bfd59425b2058ba Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 25 Sep 2018 23:25:42 +0200 Subject: [PATCH] Remove ->init() of struct receiver. The previous patch removed the ->init() method of the afh receiver. Since the afh receiver was the only receiver that defined an init method, the method can now be removed from struct receiver. As a consequence, recv_init(), which calls each receiver's init method has become a no-op and can also be removed. --- afh_recv.c | 1 - audiod.c | 1 - dccp_recv.c | 1 - http_recv.c | 1 - play.c | 3 --- recv.c | 1 - recv.h | 7 ------- recv_common.c | 21 --------------------- udp_recv.c | 1 - 9 files changed, 37 deletions(-) diff --git a/afh_recv.c b/afh_recv.c index e5e87bdd..4f8ff497 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -238,7 +238,6 @@ out: return ret; } -/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_afh_user_data = { .open = afh_recv_open, .close = afh_recv_close, diff --git a/audiod.c b/audiod.c index b93f29de..a5a77437 100644 --- a/audiod.c +++ b/audiod.c @@ -1451,7 +1451,6 @@ int main(int argc, char *argv[]) parse_config_or_die(); crypt_init(); daemon_set_priority(OPT_UINT32_VAL(PRIORITY)); - recv_init(); if (daemon_init_colors_or_die(OPT_UINT32_VAL(COLOR), COLOR_AUTO, COLOR_NO, OPT_GIVEN(LOGFILE))) { for (i = 0; i < OPT_GIVEN(LOG_COLOR); i++) diff --git a/dccp_recv.c b/dccp_recv.c index 8a08504a..639c93fc 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -151,7 +151,6 @@ out: return ret; } -/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_dccp_user_data = { .open = dccp_recv_open, .close = dccp_recv_close, diff --git a/http_recv.c b/http_recv.c index 3a723299..1fb60bad 100644 --- a/http_recv.c +++ b/http_recv.c @@ -167,7 +167,6 @@ static int http_recv_open(struct receiver_node *rn) return 1; } -/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_http_user_data = { .open = http_recv_open, .close = http_recv_close, diff --git a/play.c b/play.c index c860208c..86edc4d4 100644 --- a/play.c +++ b/play.c @@ -1238,9 +1238,6 @@ int main(int argc, char *argv[]) int ret; unsigned num_inputs; - /* needed this early to make help work */ - recv_init(); - sched.default_timeout.tv_sec = 5; parse_config_or_die(argc, argv); session_open(); diff --git a/recv.c b/recv.c index 7b46d78c..10d55d21 100644 --- a/recv.c +++ b/recv.c @@ -79,7 +79,6 @@ int main(int argc, char *argv[]) loglevel = OPT_UINT32_VAL(LOGLEVEL, lpr); version_handle_flag("recv", OPT_GIVEN(VERSION, lpr)); handle_help_flag(lpr); - recv_init(); memset(&rn, 0, sizeof(struct receiver_node)); ret = check_receiver_arg(OPT_STRING_VAL(RECEIVER, lpr), &receiver_lpr); if (ret < 0) diff --git a/recv.h b/recv.h index f88ebd84..36b0f1db 100644 --- a/recv.h +++ b/recv.h @@ -39,12 +39,6 @@ struct receiver_node { * \sa \ref http_recv.c, \ref udp_recv.c. */ struct receiver { - /** - * The optional receiver init function. - * - * Performs any initialization needed before the receiver can be opened. - */ - void (*init)(void); /** * Open one instance of the receiver. * @@ -114,7 +108,6 @@ struct receiver { /** Iterate over all available receivers. */ #define FOR_EACH_RECEIVER(i) for (i = 1; lls_cmd(i, recv_cmd_suite); i++) -void recv_init(void); int check_receiver_arg(const char *ra, struct lls_parse_result **lprp); void print_receiver_helps(bool detailed); int generic_recv_pre_select(struct sched *s, struct receiver_node *rn); diff --git a/recv_common.c b/recv_common.c index 948de474..31fd81f1 100644 --- a/recv_common.c +++ b/recv_common.c @@ -15,27 +15,6 @@ #include "recv.h" #include "string.h" -/** - * Call the init function of each paraslash receiver. - * - * Receivers employ the user_data feature of the lopsub library: Each receiver - * of the recv_cmd suite defines a struct receiver as its user data. - * recv_init() obtains a pointer to this structure by calling lls_user_data(). - * If the receiver has an init function (i.e., if ->init is not NULL), ->init() - * is called to initialize the receiver. - */ -void recv_init(void) -{ - int i; - - FOR_EACH_RECEIVER(i) { - const struct lls_command *cmd = RECV_CMD(i); - const struct receiver *r = lls_user_data(cmd); - if (r && r->init) - r->init(); - } -} - /** * Check if the given string is a valid receiver specifier. * diff --git a/udp_recv.c b/udp_recv.c index 67846b14..58d45ab4 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -186,7 +186,6 @@ err: return ret; } -/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_udp_user_data = { .open = udp_recv_open, .close = udp_recv_close, -- 2.39.2