From a5daed1d9eef83ac47d8700c45bf919c113b39dd Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 7 Mar 2011 18:06:56 +0100 Subject: [PATCH] src/: Prefix all global variables with global_. --- src/connection.c | 6 +++--- src/tlsproxy.c | 22 +++++++++++----------- src/tlsproxy.h | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/connection.c b/src/connection.c index 8f78bba..290227e 100644 --- a/src/connection.c +++ b/src/connection.c @@ -97,8 +97,8 @@ void handle_connection(int client_socket) { #endif /* Connect to proxy server or directly to server. */ - if (NULL != use_proxy_host && NULL != use_proxy_port) { - server_socket = connect_to_host(use_proxy_host, use_proxy_port); + if (NULL != global_proxy_host && NULL != global_proxy_port) { + server_socket = connect_to_host(global_proxy_host, global_proxy_port); } else { server_socket = connect_to_host(host, port); } @@ -115,7 +115,7 @@ void handle_connection(int client_socket) { } /* Connect to proxy if requested (command line option). */ - if (NULL != use_proxy_host && NULL != use_proxy_port) { + if (NULL != global_proxy_host && NULL != global_proxy_port) { fprintf(server_fd, "CONNECT %s:%s HTTP/1.0\r\n", host, port); fprintf(server_fd, "\r\n"); diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 033e5ba..39183a7 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -155,8 +155,8 @@ int main(int argc, char **argv) { #ifdef DEBUG printf("Listening for connections on port %d.\n", port); - if (NULL != use_proxy_host && NULL != use_proxy_port) { - printf("Using proxy: %s:%s.\n", use_proxy_host, use_proxy_port); + if (NULL != global_proxy_host && NULL != global_proxy_port) { + printf("Using proxy: %s:%s.\n", global_proxy_host, global_proxy_port); } #endif @@ -198,8 +198,8 @@ int main(int argc, char **argv) { free(threads); - free(use_proxy_host); - free(use_proxy_port); + free(global_proxy_host); + free(global_proxy_port); return EXIT_FAILURE; } @@ -232,20 +232,20 @@ static void parse_arguments(int argc, char **argv) { exit(EXIT_FAILURE); } - use_proxy_host = malloc((size_t)(position - optarg) + 1); - if (NULL == use_proxy_host) { + global_proxy_host = malloc((size_t)(position - optarg) + 1); + if (NULL == global_proxy_host) { perror("malloc()"); exit(EXIT_FAILURE); } - memcpy(use_proxy_host, optarg, (size_t)(position - optarg)); - use_proxy_host[position - optarg] = '\0'; + memcpy(global_proxy_host, optarg, (size_t)(position - optarg)); + global_proxy_host[position - optarg] = '\0'; - use_proxy_port = malloc(strlen(position + 1) + 1); - if (NULL == use_proxy_port) { + global_proxy_port = malloc(strlen(position + 1) + 1); + if (NULL == global_proxy_port) { perror("malloc()"); exit(EXIT_FAILURE); } - strcpy(use_proxy_port, position + 1); + strcpy(global_proxy_port, position + 1); break; } diff --git a/src/tlsproxy.h b/src/tlsproxy.h index a0db68f..4ed5541 100644 --- a/src/tlsproxy.h +++ b/src/tlsproxy.h @@ -28,7 +28,7 @@ /* Proxy hostname and port if specified on the command line. */ -char *use_proxy_host; -char *use_proxy_port; +char *global_proxy_host; +char *global_proxy_port; #endif -- 2.45.2