From c0299e1868312e623c9b2ec6646cc7d1a5fe0f69 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Mon, 15 Aug 2005 03:54:31 +0000 Subject: * [Indent] Ran Source Through indent I re-indented the source code using indent with the following options: indent -kr -bad -bap -nut -i8 -l80 -psl -sob -ss -ncs There are now _no_ tabs in the source files, and all indentation is eight spaces. Lines are 80 characters long, and the procedure type is on it's own line. Read the indent manual for more information about what each option means. --- src/conns.c | 168 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'src/conns.c') diff --git a/src/conns.c b/src/conns.c index 82cb457..627a00c 100644 --- a/src/conns.c +++ b/src/conns.c @@ -1,4 +1,4 @@ -/* $Id: conns.c,v 1.24 2005-07-12 17:39:43 rjkaes Exp $ +/* $Id: conns.c,v 1.25 2005-08-15 03:54:31 rjkaes Exp $ * * Create and free the connection structure. One day there could be * other connection related tasks put here, but for now the header @@ -27,118 +27,118 @@ #include "stats.h" struct conn_s * -initialize_conn(int client_fd, const char* ipaddr, const char* string_addr, - const char* sock_ipaddr) +initialize_conn(int client_fd, const char *ipaddr, const char *string_addr, + const char *sock_ipaddr) { - struct conn_s *connptr; - struct buffer_s *cbuffer, *sbuffer; + struct conn_s *connptr; + struct buffer_s *cbuffer, *sbuffer; - assert(client_fd >= 0); + assert(client_fd >= 0); - /* - * Allocate the memory for all the internal components - */ - cbuffer = new_buffer(); - sbuffer = new_buffer(); + /* + * Allocate the memory for all the internal components + */ + cbuffer = new_buffer(); + sbuffer = new_buffer(); - if (!cbuffer || !sbuffer) - goto error_exit; + if (!cbuffer || !sbuffer) + goto error_exit; - /* - * Allocate the space for the conn_s structure itself. - */ - connptr = safemalloc(sizeof(struct conn_s)); - if (!connptr) - goto error_exit; + /* + * Allocate the space for the conn_s structure itself. + */ + connptr = safemalloc(sizeof(struct conn_s)); + if (!connptr) + goto error_exit; - connptr->client_fd = client_fd; - connptr->server_fd = -1; + connptr->client_fd = client_fd; + connptr->server_fd = -1; - connptr->cbuffer = cbuffer; - connptr->sbuffer = sbuffer; + connptr->cbuffer = cbuffer; + connptr->sbuffer = sbuffer; - connptr->request_line = NULL; + connptr->request_line = NULL; - /* These store any error strings */ - connptr->error_variables = NULL; - connptr->error_string = NULL; - connptr->error_number = -1; + /* These store any error strings */ + connptr->error_variables = NULL; + connptr->error_string = NULL; + connptr->error_number = -1; - connptr->connect_method = FALSE; - connptr->show_stats = FALSE; + connptr->connect_method = FALSE; + connptr->show_stats = FALSE; - connptr->protocol.major = connptr->protocol.minor = 0; + connptr->protocol.major = connptr->protocol.minor = 0; - /* There is _no_ content length initially */ - connptr->content_length.server = connptr->content_length.client = -1; + /* There is _no_ content length initially */ + connptr->content_length.server = connptr->content_length.client = -1; - connptr->server_ip_addr = sock_ipaddr ? safestrdup(sock_ipaddr) : 0; - connptr->client_ip_addr = safestrdup(ipaddr); - connptr->client_string_addr = safestrdup(string_addr); + connptr->server_ip_addr = sock_ipaddr ? safestrdup(sock_ipaddr) : 0; + connptr->client_ip_addr = safestrdup(ipaddr); + connptr->client_string_addr = safestrdup(string_addr); - connptr->upstream_proxy = NULL; + connptr->upstream_proxy = NULL; - update_stats(STAT_OPEN); + update_stats(STAT_OPEN); #ifdef REVERSE_SUPPORT - connptr->reversepath = NULL; + connptr->reversepath = NULL; #endif - return connptr; + return connptr; -error_exit: - /* - * If we got here, there was a problem allocating memory - */ - if (cbuffer) - delete_buffer(cbuffer); - if (sbuffer) - delete_buffer(sbuffer); + error_exit: + /* + * If we got here, there was a problem allocating memory + */ + if (cbuffer) + delete_buffer(cbuffer); + if (sbuffer) + delete_buffer(sbuffer); - return NULL; + return NULL; } void destroy_conn(struct conn_s *connptr) { - assert(connptr != NULL); - - if (connptr->client_fd != -1) - if (close(connptr->client_fd) < 0) - log_message(LOG_INFO, "Client (%d) close message: %s", - connptr->client_fd, strerror(errno)); - if (connptr->server_fd != -1) - if (close(connptr->server_fd) < 0) - log_message(LOG_INFO, "Server (%d) close message: %s", - connptr->server_fd, strerror(errno)); - - if (connptr->cbuffer) - delete_buffer(connptr->cbuffer); - if (connptr->sbuffer) - delete_buffer(connptr->sbuffer); - - if (connptr->request_line) - safefree(connptr->request_line); - - if (connptr->error_variables) - hashmap_delete(connptr->error_variables); - - if (connptr->error_string) - safefree(connptr->error_string); - - if (connptr->server_ip_addr) - safefree(connptr->server_ip_addr); - if (connptr->client_ip_addr) - safefree(connptr->client_ip_addr); - if (connptr->client_string_addr) - safefree(connptr->client_string_addr); + assert(connptr != NULL); + + if (connptr->client_fd != -1) + if (close(connptr->client_fd) < 0) + log_message(LOG_INFO, "Client (%d) close message: %s", + connptr->client_fd, strerror(errno)); + if (connptr->server_fd != -1) + if (close(connptr->server_fd) < 0) + log_message(LOG_INFO, "Server (%d) close message: %s", + connptr->server_fd, strerror(errno)); + + if (connptr->cbuffer) + delete_buffer(connptr->cbuffer); + if (connptr->sbuffer) + delete_buffer(connptr->sbuffer); + + if (connptr->request_line) + safefree(connptr->request_line); + + if (connptr->error_variables) + hashmap_delete(connptr->error_variables); + + if (connptr->error_string) + safefree(connptr->error_string); + + if (connptr->server_ip_addr) + safefree(connptr->server_ip_addr); + if (connptr->client_ip_addr) + safefree(connptr->client_ip_addr); + if (connptr->client_string_addr) + safefree(connptr->client_string_addr); #ifdef REVERSE_SUPPORT - if (connptr->reversepath) - safefree(connptr->reversepath); + if (connptr->reversepath) + safefree(connptr->reversepath); #endif - safefree(connptr); + safefree(connptr); - update_stats(STAT_CLOSE); + update_stats(STAT_CLOSE); } -- cgit v1.2.3