changeset 1036:f782b3319553 HEAD

Removed useless parameters from io_callback_t and timeout_callback_t.
author Timo Sirainen <tss@iki.fi>
date Mon, 27 Jan 2003 03:44:34 +0200
parents fe49ece0f3ea
children 17ac2832c63f
files src/auth/login-connection.c src/auth/main.c src/auth/master-connection.c src/imap/client.c src/imap/rawlog.c src/lib-storage/index/index-mailbox-check.c src/lib/ioloop-internal.h src/lib/ioloop-poll.c src/lib/ioloop-select.c src/lib/ioloop.c src/lib/ioloop.h src/lib/ostream-file.c src/login/auth-connection.c src/login/client-authenticate.c src/login/client.c src/login/client.h src/login/main.c src/login/master.c src/login/ssl-proxy-gnutls.c src/master/auth-process.c src/master/login-process.c src/master/main.c src/master/ssl-init.c
diffstat 23 files changed, 56 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/login-connection.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/auth/login-connection.c	Mon Jan 27 03:44:34 2003 +0200
@@ -138,8 +138,7 @@
 	}
 }
 
-static void login_input(void *context, int fd __attr_unused__,
-			struct io *io __attr_unused__)
+static void login_input(void *context)
 {
 	struct login_connection *conn  = context;
 
--- a/src/auth/main.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/auth/main.c	Mon Jan 27 03:44:34 2003 +0200
@@ -26,12 +26,11 @@
 	io_loop_stop(ioloop);
 }
 
-static void auth_accept(void *context __attr_unused__, int listen_fd,
-			struct io *io __attr_unused__)
+static void auth_accept(void *context __attr_unused__)
 {
 	int fd;
 
-	fd = net_accept(listen_fd, NULL, NULL);
+	fd = net_accept(LOGIN_LISTEN_FD, NULL, NULL);
 	if (fd < 0) {
 		if (fd < -1)
 			i_fatal("accept() failed: %m");
--- a/src/auth/master-connection.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/auth/master-connection.c	Mon Jan 27 03:44:34 2003 +0200
@@ -110,12 +110,11 @@
 	}
 }
 
-static void master_input(void *context __attr_unused__, int fd,
-			 struct io *io __attr_unused__)
+static void master_input(void *context __attr_unused__)
 {
 	int ret;
 
-	ret = net_receive(fd, master_buf + master_pos,
+	ret = net_receive(MASTER_SOCKET_FD, master_buf + master_pos,
 			  sizeof(master_buf) - master_pos);
 	if (ret < 0) {
 		/* master died, kill ourself too */
@@ -129,7 +128,7 @@
 
 	/* reply is now read */
 	master_handle_request((struct auth_master_request *) master_buf,
-			      fd);
+			      MASTER_SOCKET_FD);
 	master_pos = 0;
 }
 
--- a/src/imap/client.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/imap/client.c	Mon Jan 27 03:44:34 2003 +0200
@@ -30,8 +30,7 @@
 static struct client *my_client; /* we don't need more than one currently */
 static struct timeout *to_idle;
 
-static void client_input(void *context, int fd __attr_unused__,
-			 struct io *io __attr_unused__);
+static void client_input(void *context);
 
 static void client_output_timeout(void *context)
 {
@@ -313,8 +312,7 @@
 	return TRUE;
 }
 
-static void client_input(void *context, int fd __attr_unused__,
-			 struct io *io __attr_unused__)
+static void client_input(void *context)
 {
 	struct client *client = context;
 
@@ -345,8 +343,7 @@
 		client_destroy(client);
 }
 
-static void idle_timeout(void *context __attr_unused__,
-			 struct timeout *timeout __attr_unused__)
+static void idle_timeout(void *context __attr_unused__)
 {
 	if (my_client == NULL)
 		return;
--- a/src/imap/rawlog.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/imap/rawlog.c	Mon Jan 27 03:44:34 2003 +0200
@@ -76,14 +76,12 @@
 	last_write = time(NULL);
 }
 
-static void imap_input(void *context __attr_unused__, int fd __attr_unused__,
-		       struct io *io __attr_unused__)
+static void imap_input(void *context __attr_unused__)
 {
 	copy(imap_in, client_out, log_out);
 }
 
-static void client_input(void *context __attr_unused__, int fd __attr_unused__,
-			 struct io *io __attr_unused__)
+static void client_input(void *context __attr_unused__)
 {
 	copy(client_in, imap_out, log_in);
 }
--- a/src/lib-storage/index/index-mailbox-check.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib-storage/index/index-mailbox-check.c	Mon Jan 27 03:44:34 2003 +0200
@@ -9,8 +9,7 @@
 
 static int check_interval = -1;
 
-static void check_timeout(void *context,
-			  struct timeout *timeout __attr_unused__)
+static void check_timeout(void *context)
 {
 	struct index_mailbox *ibox = context;
 	struct stat st;
--- a/src/lib/ioloop-internal.h	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ioloop-internal.h	Mon Jan 27 03:44:34 2003 +0200
@@ -29,7 +29,7 @@
 	unsigned int destroyed:1;
 	unsigned int invalid:1;
 
-	io_callback_t callback;
+	io_callback_t *callback;
         void *context;
 };
 
@@ -41,7 +41,7 @@
 	int run_now;
         int destroyed;
 
-	timeout_callback_t callback;
+	timeout_callback_t *callback;
         void *context;
 };
 
--- a/src/lib/ioloop-poll.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ioloop-poll.c	Mon Jan 27 03:44:34 2003 +0200
@@ -209,7 +209,7 @@
 		}
 
 		t_id = t_push();
-		io->callback(io->context, io->fd, io);
+		io->callback(io->context);
 		if (t_pop() != t_id)
 			i_panic("Leaked a t_pop() call!");
 
--- a/src/lib/ioloop-select.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ioloop-select.c	Mon Jan 27 03:44:34 2003 +0200
@@ -126,7 +126,7 @@
                         continue;
 
 		t_id = t_push();
-		io->callback(io->context, io->fd, io);
+		io->callback(io->context);
 		if (t_pop() != t_id)
 			i_panic("Leaked a t_pop() call!");
 
--- a/src/lib/ioloop.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ioloop.c	Mon Jan 27 03:44:34 2003 +0200
@@ -83,14 +83,14 @@
 	}
 }
 
-struct io *io_add(int fd, int condition, io_callback_t callback, void *data)
+struct io *io_add(int fd, int condition, io_callback_t *callback, void *data)
 {
 	return io_add_priority(fd, IO_PRIORITY_DEFAULT,
 			       condition, callback, data);
 }
 
 struct io *io_add_priority(int fd, int priority, int condition,
-			   io_callback_t callback, void *context)
+			   io_callback_t *callback, void *context)
 {
 	struct io *io;
 
@@ -184,7 +184,7 @@
 	}
 }
 
-struct timeout *timeout_add(int msecs, timeout_callback_t callback,
+struct timeout *timeout_add(int msecs, timeout_callback_t *callback,
 			    void *context)
 {
 	struct timeout *timeout;
@@ -281,7 +281,7 @@
                 timeout_update_next(t, &ioloop_timeval);
 
                 t_id = t_push();
-		t->callback(t->context, t);
+		t->callback(t->context);
 		if (t_pop() != t_id)
                         i_panic("Leaked a t_pop() call!");
 	}
--- a/src/lib/ioloop.h	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ioloop.h	Mon Jan 27 03:44:34 2003 +0200
@@ -14,8 +14,8 @@
 struct timeout;
 struct ioloop;
 
-typedef void (*io_callback_t) (void *context, int fd, struct io *io);
-typedef void (*timeout_callback_t) (void *context, struct timeout *timeout);
+typedef void io_callback_t(void *context);
+typedef void timeout_callback_t(void *context);
 
 /* Time when the I/O loop started calling handlers.
    Can be used instead of time(NULL). */
@@ -26,13 +26,13 @@
 /* I/O listeners - you can create different handlers for IO_READ and IO_WRITE,
    but make sure you don't create multiple handlers of same type, it's not
    checked and removing one will stop the other from working as well. */
-struct io *io_add(int fd, int condition, io_callback_t callback, void *context);
+struct io *io_add(int fd, int condition, io_callback_t *callback, void *context);
 struct io *io_add_priority(int fd, int priority, int condition,
-			   io_callback_t callback, void *context);
+			   io_callback_t *callback, void *context);
 void io_remove(struct io *io);
 
 /* Timeout handlers */
-struct timeout *timeout_add(int msecs, timeout_callback_t callback,
+struct timeout *timeout_add(int msecs, timeout_callback_t *callback,
 			    void *context);
 void timeout_remove(struct timeout *timeout);
 
--- a/src/lib/ostream-file.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/lib/ostream-file.c	Mon Jan 27 03:44:34 2003 +0200
@@ -410,8 +410,7 @@
 	fstream->buffer_size = size;
 }
 
-static void stream_send_io(void *context, int fd __attr_unused__,
-			   struct io *io __attr_unused__)
+static void stream_send_io(void *context)
 {
 	struct file_ostream *fstream = context;
 	struct iovec iov[2];
--- a/src/login/auth-connection.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/auth-connection.c	Mon Jan 27 03:44:34 2003 +0200
@@ -27,7 +27,7 @@
 static struct timeout *to;
 
 static void auth_connection_destroy(struct auth_connection *conn);
-static void auth_input(void *context, int fd, struct io *io);
+static void auth_input(void *context);
 static void auth_connect_missing(void);
 
 static struct auth_connection *auth_connection_find(const char *path)
@@ -190,8 +190,7 @@
 		request_destroy(request);
 }
 
-static void auth_input(void *context, int fd __attr_unused__,
-		       struct io *io __attr_unused__)
+static void auth_input(void *context)
 {
 	struct auth_connection *conn = context;
         struct auth_login_handshake_output handshake;
@@ -345,8 +344,7 @@
 }
 
 static void
-auth_connect_missing_timeout(void *context __attr_unused__,
-			     struct timeout *timeout __attr_unused__)
+auth_connect_missing_timeout(void *context __attr_unused__)
 {
 	if (auth_reconnect)
                 auth_connect_missing();
--- a/src/login/client-authenticate.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/client-authenticate.c	Mon Jan 27 03:44:34 2003 +0200
@@ -256,8 +256,7 @@
 		client_send_auth_data(client, data, reply->data_size);
 }
 
-static void client_auth_input(void *context, int fd __attr_unused__,
-			      struct io *io __attr_unused__)
+static void client_auth_input(void *context)
 {
 	struct client *client = context;
 	buffer_t *buf;
--- a/src/login/client.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/client.c	Mon Jan 27 03:44:34 2003 +0200
@@ -245,8 +245,7 @@
 	}
 }
 
-void client_input(void *context, int fd __attr_unused__,
-		  struct io *io __attr_unused__)
+void client_input(void *context)
 {
 	struct client *client = context;
 
@@ -422,8 +421,7 @@
 	}
 }
 
-static void idle_timeout(void *context __attr_unused__,
-			 struct timeout *timeout __attr_unused__)
+static void idle_timeout(void *context __attr_unused__)
 {
 	hash_foreach(clients, client_hash_check_idle, NULL);
 }
--- a/src/login/client.h	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/client.h	Mon Jan 27 03:44:34 2003 +0200
@@ -42,7 +42,7 @@
 void client_syslog(struct client *client, const char *text);
 
 int client_read(struct client *client);
-void client_input(void *context, int fd, struct io *io);
+void client_input(void *context);
 
 unsigned int clients_get_count(void);
 void clients_destroy_all(void);
--- a/src/login/main.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/main.c	Mon Jan 27 03:44:34 2003 +0200
@@ -71,13 +71,12 @@
 	io_loop_stop(ioloop);
 }
 
-static void login_accept(void *context __attr_unused__, int listen_fd,
-			 struct io *io __attr_unused__)
+static void login_accept(void *context __attr_unused__)
 {
 	struct ip_addr ip;
 	int fd;
 
-	fd = net_accept(listen_fd, &ip, NULL);
+	fd = net_accept(LOGIN_IMAP_LISTEN_FD, &ip, NULL);
 	if (fd < 0) {
 		if (fd < -1)
 			i_fatal("accept() failed: %m");
@@ -90,14 +89,13 @@
 	(void)client_create(fd, &ip, FALSE);
 }
 
-static void login_accept_ssl(void *context __attr_unused__, int listen_fd,
-			     struct io *io __attr_unused__)
+static void login_accept_ssl(void *context __attr_unused__)
 {
 	struct client *client;
 	struct ip_addr addr;
 	int fd, fd_ssl;
 
-	fd = net_accept(listen_fd, &addr, NULL);
+	fd = net_accept(LOGIN_IMAPS_LISTEN_FD, &addr, NULL);
 	if (fd < 0) {
 		if (fd < -1)
 			i_fatal("accept() failed: %m");
--- a/src/login/master.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/master.c	Mon Jan 27 03:44:34 2003 +0200
@@ -80,12 +80,11 @@
 	main_unref();
 }
 
-static void master_input(void *context __attr_unused__, int fd,
-			 struct io *io __attr_unused__)
+static void master_input(void *context __attr_unused__)
 {
 	int ret;
 
-	ret = net_receive(fd, master_buf + master_pos,
+	ret = net_receive(LOGIN_MASTER_SOCKET_FD, master_buf + master_pos,
 			  sizeof(master_buf) - master_pos);
 	if (ret < 0) {
 		/* master died, kill all clients logging in */
--- a/src/login/ssl-proxy-gnutls.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/login/ssl-proxy-gnutls.c	Mon Jan 27 03:44:34 2003 +0200
@@ -46,8 +46,8 @@
 static gnutls_dh_params dh_params;
 static gnutls_rsa_params rsa_params;
 
-static void ssl_input(void *context, int handle, struct io *io);
-static void plain_input(void *context, int handle, struct io *io);
+static void ssl_input(void *context);
+static void plain_input(void *context);
 static int ssl_proxy_destroy(struct ssl_proxy *proxy);
 
 static const char *get_alert_text(struct ssl_proxy *proxy)
@@ -138,8 +138,7 @@
 	return FALSE;
 }
 
-static void ssl_output(void *context, int fd __attr_unused__,
-		       struct io *io __attr_unused__)
+static void ssl_output(void *context)
 {
         struct ssl_proxy *proxy = context;
 	int sent;
@@ -164,8 +163,7 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_READ, ssl_input, proxy);
 }
 
-static void ssl_input(void *context, int fd __attr_unused__,
-		      struct io *io __attr_unused__)
+static void ssl_input(void *context)
 {
         struct ssl_proxy *proxy = context;
 	int rcvd, sent;
@@ -194,8 +192,7 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_WRITE, ssl_output, proxy);
 }
 
-static void plain_output(void *context, int fd __attr_unused__,
-			 struct io *io __attr_unused__)
+static void plain_output(void *context)
 {
 	struct ssl_proxy *proxy = context;
 	int sent;
@@ -213,8 +210,7 @@
 	proxy->io_plain = io_add(proxy->fd_plain, IO_READ, plain_input, proxy);
 }
 
-static void plain_input(void *context, int fd __attr_unused__,
-			struct io *io __attr_unused__)
+static void plain_input(void *context)
 {
 	struct ssl_proxy *proxy = context;
 	char buf[1024];
@@ -240,8 +236,7 @@
 	proxy->io_plain = io_add(proxy->fd_ssl, IO_WRITE, plain_output, proxy);
 }
 
-static void ssl_handshake(void *context, int fd __attr_unused__,
-			  struct io *io __attr_unused__)
+static void ssl_handshake(void *context)
 {
 	struct ssl_proxy *proxy = context;
 	int ret, dir;
@@ -319,7 +314,7 @@
 	proxy->fd_plain = sfd[0];
 
 	proxy->refcount++;
-	ssl_handshake(proxy, -1, NULL);
+	ssl_handshake(proxy);
 	if (!ssl_proxy_destroy(proxy))
 		return -1;
 
--- a/src/master/auth-process.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/master/auth-process.c	Mon Jan 27 03:44:34 2003 +0200
@@ -117,8 +117,7 @@
 	hash_insert(process->requests, POINTER_CAST(req.tag), context);
 }
 
-static void auth_process_input(void *context, int fd __attr_unused__,
-			       struct io *io __attr_unused__)
+static void auth_process_input(void *context)
 {
 	struct auth_process *p = context;
 	const unsigned char *data;
@@ -386,8 +385,7 @@
 }
 
 static void
-auth_processes_start_missing(void *context __attr_unused__,
-			     struct timeout *timeout __attr_unused__)
+auth_processes_start_missing(void *context __attr_unused__)
 {
 	struct auth_config *config;
 	unsigned int count;
--- a/src/master/login-process.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/master/login-process.c	Mon Jan 27 03:44:34 2003 +0200
@@ -100,8 +100,7 @@
 		oldest_nonlisten_process = p;
 }
 
-static void login_process_input(void *context, int fd __attr_unused__,
-				struct io *io __attr_unused__)
+static void login_process_input(void *context)
 {
 	struct login_process *p = context;
 	struct auth_process *auth_process;
@@ -369,8 +368,7 @@
 }
 
 static void
-login_processes_start_missing(void *context __attr_unused__,
-			      struct timeout *timeout __attr_unused__)
+login_processes_start_missing(void *context __attr_unused__)
 {
 	if (!set_login_process_per_connection) {
 		/* create max. one process every second, that way if it keeps
--- a/src/master/main.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/master/main.c	Mon Jan 27 03:44:34 2003 +0200
@@ -104,8 +104,7 @@
 	return NULL;
 }
 
-static void timeout_handler(void *context __attr_unused__,
-			    struct timeout *timeout __attr_unused__)
+static void timeout_handler(void *context __attr_unused__)
 {
 	const char *process_type_name, *msg;
 	pid_t pid;
@@ -261,7 +260,7 @@
 		i_warning("Killed with signal %d", lib_signal_kill);
 
 	/* make sure we log if child processes died unexpectedly */
-	timeout_handler(NULL, NULL);
+	timeout_handler(NULL);
 
 	login_processes_deinit();
 	auth_processes_deinit();
--- a/src/master/ssl-init.c	Mon Jan 27 03:33:40 2003 +0200
+++ b/src/master/ssl-init.c	Mon Jan 27 03:44:34 2003 +0200
@@ -64,7 +64,7 @@
 	generating = FALSE;
 }
 
-static void check_parameters_file(void)
+static void check_parameters_file(void *context __attr_unused__)
 {
 	struct stat st;
 	time_t regen_time;
@@ -94,10 +94,9 @@
 	generating = FALSE;
 
 	/* check every 10 mins */
-	to = timeout_add(600*1000,
-			 (timeout_callback_t)check_parameters_file, NULL);
+	to = timeout_add(600 * 1000, check_parameters_file, NULL);
 
-	check_parameters_file();
+	check_parameters_file(NULL);
 }
 
 void ssl_deinit(void)