From: Arran Cudbard-Bell Date: Tue, 8 Nov 2016 17:11:50 +0000 (-0500) Subject: s/fr_event_list_create/fr_event_list_init/ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f75509b29f38f6181dd5dfaaced9a64e019a0e;p=thirdparty%2Ffreeradius-server.git s/fr_event_list_create/fr_event_list_init/ --- diff --git a/src/include/event.h b/src/include/event.h index 3140c0029b2..4a4c5bc67a1 100644 --- a/src/include/event.h +++ b/src/include/event.h @@ -37,7 +37,7 @@ typedef void (*fr_event_callback_t)(void *, struct timeval *now); typedef void (*fr_event_status_t)(struct timeval *); typedef void (*fr_event_fd_handler_t)(fr_event_list_t *el, int sock, void *ctx); -fr_event_list_t *fr_event_list_create(TALLOC_CTX *ctx, fr_event_status_t status); +fr_event_list_t *fr_event_list_init(TALLOC_CTX *ctx, fr_event_status_t status); int fr_event_list_num_fds(fr_event_list_t *el); int fr_event_list_num_elements(fr_event_list_t *el); diff --git a/src/lib/event.c b/src/lib/event.c index 12de052107c..70b6e50c7ae 100644 --- a/src/lib/event.c +++ b/src/lib/event.c @@ -85,6 +85,16 @@ static int fr_event_list_time_cmp(void const *one, void const *two) return 0; } +static int fr_event_fd_cmp(void const *a, void const *b) +{ + fr_event_fd_t const *efd_a = a; + fr_event_fd_t const *efd_b = b; + + if (efd_a->fd > efd_b->fd) return +1; + if (efd_a->fd < efd_b->fd) return -1; + + return 0; +} static int _event_list_free(fr_event_list_t *list) { @@ -103,7 +113,7 @@ static int _event_list_free(fr_event_list_t *list) } -fr_event_list_t *fr_event_list_create(TALLOC_CTX *ctx, fr_event_status_t status) +fr_event_list_t *fr_event_list_init(TALLOC_CTX *ctx, fr_event_status_t status) { int i; fr_event_list_t *el; @@ -633,7 +643,7 @@ int main(int argc, char **argv) struct timeval now, when; fr_event_list_t *el; - el = fr_event_list_create(NULL, NULL); + el = fr_event_list_init(NULL, NULL); if (!el) exit(1); memset(&rand_pool, 0, sizeof(rand_pool)); diff --git a/src/main/process.c b/src/main/process.c index 04481563ece..a06883706e3 100644 --- a/src/main/process.c +++ b/src/main/process.c @@ -5182,7 +5182,7 @@ static void event_signal_handler(UNUSED fr_event_list_t *xel, * Externally-visibly functions. */ int radius_event_init(TALLOC_CTX *ctx) { - el = fr_event_list_create(ctx, event_status); + el = fr_event_list_init(ctx, event_status); if (!el) return 0; #ifdef HAVE_SYSTEMD_WATCHDOG diff --git a/src/main/radsniff.c b/src/main/radsniff.c index 0ccf9cc39b7..f3616fb75b7 100644 --- a/src/main/radsniff.c +++ b/src/main/radsniff.c @@ -2786,7 +2786,7 @@ int main(int argc, char *argv[]) char *buff; - events = fr_event_list_create(conf, _rs_event_status); + events = fr_event_list_init(conf, _rs_event_status); if (!events) { ERROR(); goto finish; diff --git a/src/main/threads.c b/src/main/threads.c index 8296a879b38..a05db68ed17 100644 --- a/src/main/threads.c +++ b/src/main/threads.c @@ -455,7 +455,7 @@ static void *thread_handler(void *arg) ctx = talloc_init("thread_pool"); - el = fr_event_list_create(ctx, NULL); + el = fr_event_list_init(ctx, NULL); rad_assert(el != NULL); local_backlog = fr_heap_create(timestamp_cmp, offsetof(REQUEST, heap_id)); diff --git a/src/modules/proto_bfd/proto_bfd.c b/src/modules/proto_bfd/proto_bfd.c index 5e870668cdf..cb3202d78c6 100644 --- a/src/modules/proto_bfd/proto_bfd.c +++ b/src/modules/proto_bfd/proto_bfd.c @@ -317,7 +317,7 @@ static int bfd_pthread_create(bfd_state_t *session) return 0; } - session->el = fr_event_list_create(session, NULL); + session->el = fr_event_list_init(session, NULL); if (!session->el) { ERROR("Failed creating event list"); close_pipes: