[dovecot-cvs] dovecot/src/master auth-process.c, 1.97, 1.98 auth-process.h, 1.9, 1.10 dict-process.c, 1.8, 1.9 log.c, 1.11, 1.12 login-process.c, 1.88, 1.89 master-settings.c, 1.145, 1.146

tss at dovecot.org tss at dovecot.org
Fri Dec 15 18:38:27 UTC 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv3614/master

Modified Files:
	auth-process.c auth-process.h dict-process.c log.c 
	login-process.c master-settings.c 
Log Message:
Replaced void *context from a lot of callbacks with the actual context
type. Also added/fixed some context type checks.



Index: auth-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- auth-process.c	1 Jul 2006 21:19:37 -0000	1.97
+++ auth-process.c	15 Dec 2006 18:38:24 -0000	1.98
@@ -64,7 +64,8 @@
 static void auth_processes_start_missing(void *context);
 
 void auth_process_request(struct auth_process *process, unsigned int login_pid,
-			  unsigned int login_id, void *context)
+			  unsigned int login_id,
+			  struct login_auth_request *request)
 {
 	string_t *str;
 	ssize_t ret;
@@ -88,7 +89,7 @@
 		}
 		auth_process_destroy(process);
 	} else {
-		hash_insert(process->requests, POINTER_CAST(auth_tag), context);
+		hash_insert(process->requests, POINTER_CAST(auth_tag), request);
 	}
 	t_pop();
 }
@@ -96,7 +97,7 @@
 static bool
 auth_process_input_user(struct auth_process *process, const char *args)
 {
-	void *context;
+	struct login_auth_request *request;
 	const char *const *list;
 	unsigned int id;
 
@@ -110,14 +111,14 @@
 	}
 	id = (unsigned int)strtoul(list[0], NULL, 10);
 
-	context = hash_lookup(process->requests, POINTER_CAST(id));
-	if (context == NULL) {
+	request = hash_lookup(process->requests, POINTER_CAST(id));
+	if (request == NULL) {
 		i_error("BUG: Auth process %s sent unrequested reply with ID "
 			"%u", dec2str(process->pid), id);
 		return FALSE;
 	}
 
-	auth_master_callback(list[1], list + 2, context);
+	auth_master_callback(list[1], list + 2, request);
 	hash_remove(process->requests, POINTER_CAST(id));
 	return TRUE;
 }
@@ -125,19 +126,19 @@
 static bool
 auth_process_input_notfound(struct auth_process *process, const char *args)
 {
-	void *context;
+	struct login_auth_request *request;
 	unsigned int id;
 
 	id = (unsigned int)strtoul(args, NULL, 10);
 
-	context = hash_lookup(process->requests, POINTER_CAST(id));
-	if (context == NULL) {
+	request = hash_lookup(process->requests, POINTER_CAST(id));
+	if (request == NULL) {
 		i_error("BUG: Auth process %s sent unrequested reply with ID "
 			"%u", dec2str(process->pid), id);
 		return FALSE;
 	}
 
-	auth_master_callback(NULL, NULL, context);
+	auth_master_callback(NULL, NULL, request);
 	hash_remove(process->requests, POINTER_CAST(id));
 	return TRUE;
 }
@@ -172,7 +173,7 @@
 static bool
 auth_process_input_fail(struct auth_process *process, const char *args)
 {
-	void *context;
+	struct login_auth_request *request;
  	const char *error;
 	unsigned int id;
 
@@ -182,21 +183,20 @@
 
 	id = (unsigned int)strtoul(args, NULL, 10);
 
-	context = hash_lookup(process->requests, POINTER_CAST(id));
-	if (context == NULL) {
+	request = hash_lookup(process->requests, POINTER_CAST(id));
+	if (request == NULL) {
 		i_error("BUG: Auth process %s sent unrequested reply with ID "
 			"%u", dec2str(process->pid), id);
 		return FALSE;
 	}
 
-	auth_master_callback(NULL, NULL, context);
+	auth_master_callback(NULL, NULL, request);
 	hash_remove(process->requests, POINTER_CAST(id));
 	return TRUE;
 }
 
-static void auth_process_input(void *context)
+static void auth_process_input(struct auth_process *process)
 {
-	struct auth_process *process = context;
 	const char *line;
 	bool ret;
 
@@ -255,9 +255,8 @@
 	}
 }
 
-static void auth_worker_input(void *context)
+static void auth_worker_input(struct auth_process *p)
 {
-	struct auth_process *p = context;
 	int fd;
 
 	fd = net_accept(p->worker_listen_fd, NULL, NULL);

Index: auth-process.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- auth-process.h	13 Oct 2004 16:38:35 -0000	1.9
+++ auth-process.h	15 Dec 2006 18:38:24 -0000	1.10
@@ -1,15 +1,18 @@
 #ifndef __AUTH_PROCESS_H
 #define __AUTH_PROCESS_H
 
+struct login_auth_request;
+
 void auth_master_callback(const char *user, const char *const *args,
-			  void *context);
+			  struct login_auth_request *request);
 
 /* Find process for given id */
 struct auth_process *auth_process_find(unsigned int pid);
 
 /* Request information about given cookie */
 void auth_process_request(struct auth_process *process, unsigned int login_pid,
-			  unsigned int login_id, void *context);
+			  unsigned int login_id,
+			  struct login_auth_request *request);
 
 /* Close any fds used by auth processes */
 void auth_processes_destroy_all(void);

Index: dict-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/dict-process.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dict-process.c	17 Jun 2006 12:25:08 -0000	1.8
+++ dict-process.c	15 Dec 2006 18:38:24 -0000	1.9
@@ -96,10 +96,8 @@
 	return -1;
 }
 
-static void dict_process_listen_input(void *context)
+static void dict_process_listen_input(struct dict_process *process)
 {
-	struct dict_process *process = context;
-
 	i_assert(process->log == NULL);
 	dict_process_start(process);
 }

Index: log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/log.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- log.c	13 Oct 2006 17:59:41 -0000	1.11
+++ log.c	15 Dec 2006 18:38:24 -0000	1.12
@@ -71,10 +71,8 @@
 		to = timeout_add(1000, log_throttle_timeout, NULL);
 }
 
-static void log_read_callback(void *context)
+static void log_read_callback(struct log_io *log_io)
 {
-	struct log_io *log_io = context;
-
 	(void)log_read(log_io);
 }
 

Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- login-process.c	4 Nov 2006 12:05:13 -0000	1.88
+++ login-process.c	15 Dec 2006 18:38:24 -0000	1.89
@@ -85,9 +85,8 @@
 }
 
 void auth_master_callback(const char *user, const char *const *args,
-			  void *context)
+			  struct login_auth_request *request)
 {
-	struct login_auth_request *request = context;
 	struct master_login_reply master_reply;
 	ssize_t ret;
 
@@ -360,9 +359,8 @@
 	return 1;
 }
 
-static void login_process_input(void *context)
+static void login_process_input(struct login_process *p)
 {
-	struct login_process *p = context;
 	struct auth_process *auth_process;
 	struct login_auth_request *authreq;
 	struct master_login_request req;

Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- master-settings.c	12 Nov 2006 19:50:50 -0000	1.145
+++ master-settings.c	15 Dec 2006 18:38:24 -0000	1.146
@@ -1032,9 +1032,8 @@
 }
 
 static const char *parse_setting(const char *key, const char *value,
-				 void *context)
+				 struct settings_parse_ctx *ctx)
 {
-	struct settings_parse_ctx *ctx = context;
 	const char *error;
 
 	/* backwards compatibility */
@@ -1170,10 +1169,9 @@
 	return server;
 }
 
-static bool parse_section(const char *type, const char *name, void *context,
-			  const char **errormsg)
+static bool parse_section(const char *type, const char *name,
+			  struct settings_parse_ctx *ctx, const char **errormsg)
 {
-	struct settings_parse_ctx *ctx = context;
 	struct server_settings *server;
 
 	if (type == NULL) {



More information about the dovecot-cvs mailing list