From 7482f10d37782bbca56237357323521f2d87ea54 Mon Sep 17 00:00:00 2001
From: Simon Ruderich <simon@ruderich.org>
Date: Mon, 7 Mar 2011 06:52:41 +0100
Subject: [PATCH] src/*.c: Always use constants on the left in comparisons.

---
 src/connection.c | 8 ++++----
 src/tlsproxy.c   | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index 4160c7f..a42fbe0 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -71,10 +71,10 @@ void handle_connection(int client_socket) {
 
     /* Read request line (CONNECT ..) and headers (they are discarded). */
     result = read_http_request(client_fd, buffer, sizeof(buffer));
-    if (result == -1) {
+    if (-1 == result) {
         /* Read error. */
         return;
-    } else if (result == -2) {
+    } else if (-2 == result) {
         /* EOF */
         send_close_bad_request(client_fd);
         return;
@@ -120,11 +120,11 @@ void handle_connection(int client_socket) {
 
         /* Read response line from proxy server. */
         result = read_http_request(server_fd, buffer, sizeof(buffer));
-        if (result == -1) {
+        if (-1 == result) {
             /* Read error. */
             send_close_forwarding_failure(client_fd);
             return;
-        } else if (result == -2) {
+        } else if (-2 == result) {
             /* EOF */
             fclose(server_fd);
             send_close_forwarding_failure(client_fd);
diff --git a/src/tlsproxy.c b/src/tlsproxy.c
index 9c3b53c..7c70133 100644
--- a/src/tlsproxy.c
+++ b/src/tlsproxy.c
@@ -291,7 +291,7 @@ static void worker_thread(void) {
         V(ringbuffer_free);
 
         /* Negative value indicates we should shut down our thread. */
-        if (client_socket < 0) {
+        if (0 > client_socket) {
             break;
         }
 
-- 
2.49.0