From 8d697f065168edfa9dc9935677ea56c2b846e767 Mon Sep 17 00:00:00 2001 From: Michal Bloch Date: Tue, 6 Dec 2022 14:46:28 +0100 Subject: [PATCH] dlog_logger: remove duplicate code Change-Id: I218b74301576afdd18cb61dcf0be4a05b85c9208 --- src/logger/logger_internal.h | 1 - src/logger/reader_common.c | 10 ++-------- src/logger/reader_common.h | 1 - 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/logger/logger_internal.h b/src/logger/logger_internal.h index 62aa4c1..b6fc0d9 100644 --- a/src/logger/logger_internal.h +++ b/src/logger/logger_internal.h @@ -159,7 +159,6 @@ struct logger_config_data { }; void remove_reader_fd_entities(struct logger *server, struct reader_common *reader); -void reader_deinit_common(struct reader_common *reader); void check_if_fd_limit_reached(struct logger *server, int err); int service_writer_kmsg(struct logger *server, struct writer *wr, struct epoll_event *event); int service_writer_socket(struct logger *server, struct writer *wr, struct epoll_event *event); diff --git a/src/logger/reader_common.c b/src/logger/reader_common.c index 3ca97e4..88a525a 100644 --- a/src/logger/reader_common.c +++ b/src/logger/reader_common.c @@ -4,7 +4,7 @@ #include -void reader_deinit_common(struct reader_common *reader) +static void reader_deinit_common(struct reader_common *reader) { list_clear_custom(&reader->subs, NULL, subreader_free); @@ -65,13 +65,7 @@ void reader_free(struct reader_common *reader) return; reader->free_reader(reader); - - list_clear_custom(&reader->subs, NULL, subreader_free); - - if (reader->fd_entity_sink.fd >= 0) - close(reader->fd_entity_sink.fd); - if (reader->fd_entity_source.fd >= 0) - close(reader->fd_entity_source.fd); + reader_deinit_common(reader); free(reader); } diff --git a/src/logger/reader_common.h b/src/logger/reader_common.h index 7a4a455..d1a4da1 100644 --- a/src/logger/reader_common.h +++ b/src/logger/reader_common.h @@ -56,7 +56,6 @@ struct subreader_flush_args { int flush_time; }; -void reader_deinit_common(struct reader_common *reader); int reader_flush(struct reader_common *reader, struct timespec now_mono, int flush); void reader_free(struct reader_common *reader); void reader_free_ptr(void *reader); -- 2.7.4