From 912c095f7b9ee1b3fe0476193cbdda2e985b83ab Mon Sep 17 00:00:00 2001
From: Euler Taveira de Oliveira <euler@timbira.com>
Date: Wed, 18 Dec 2013 20:38:33 -0300
Subject: [PATCH] Fix a bunch of typos.

---
 doc/config.txt    |  2 +-
 doc/todo.txt      | 12 ++++++------
 include/bouncer.h |  8 ++++----
 src/admin.c       |  4 ++--
 src/client.c      |  4 ++--
 src/janitor.c     |  4 ++--
 src/loader.c      |  4 ++--
 src/main.c        |  6 +++---
 src/objects.c     |  4 ++--
 src/pooler.c      |  2 +-
 src/proto.c       |  2 +-
 src/sbuf.c        |  2 +-
 src/server.c      |  2 +-
 src/system.c      |  2 +-
 src/util.c        |  2 +-
 src/varcache.c    |  2 +-
 test/asynctest.c  |  2 +-
 17 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/doc/config.txt b/doc/config.txt
index 9cd3907..49e8480 100644
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -309,7 +309,7 @@ for 8.3 and above its enough to do:
 
 When transaction pooling is used, the `server_reset_query` should be empty,
 as clients should not use any session features.  If client does use session
-features, then they will be broken as transaction pooling will not guaratee
+features, then they will be broken as transaction pooling will not guarantee
 that next query will be run on same connection.
 
 Default: DISCARD ALL
diff --git a/doc/todo.txt b/doc/todo.txt
index a8f6d36..a0e804d 100644
--- a/doc/todo.txt
+++ b/doc/todo.txt
@@ -54,16 +54,16 @@ Waiting for contributors...
  * units for config parameters.
  * some preliminary notification that fd limit is full
 
- * Move all "look-at-full-packet" situtations to SBUF_EV_PKT_CALLBACK
+ * Move all "look-at-full-packet" situations to SBUF_EV_PKT_CALLBACK
 
  * `pool_mode = plproxy` - use postgres in full-duplex mode for autocommit
    queries, multiplexing several queries into one connection.  Should result
-   in more effiicent CPU usage of server.
+   in more efficient CPU usage of server.
 
- * SMP: spread sockets over per-cpu threads.  needs confirmation that
-   single-threadedness can be problem.  it can also be that only
-   accept() + login handling of short connection is problem.
+ * SMP: spread sockets over per-cpu threads.  Needs confirmation that
+   single-threadedness can be problem.  It can also be that only
+   accept() + login handling of short connection is problem
    that could be solved by just having threads for login handling,
-   which would be lot simpler.  or just deciding that its not
+   which would be lot simpler or just deciding that it is not
    worth fixing.
 
diff --git a/include/bouncer.h b/include/bouncer.h
index 60d33d5..efc608a 100644
--- a/include/bouncer.h
+++ b/include/bouncer.h
@@ -43,7 +43,7 @@
 #define FULLVER   PACKAGE_NAME " version " PACKAGE_VERSION
 #endif
 
-/* each state corresponts to a list */
+/* each state corresponds to a list */
 enum SocketState {
 	CL_FREE,		/* free_client_list */
 	CL_JUSTFREE,		/* justfree_client_list */
@@ -193,7 +193,7 @@ struct PgPool {
 	struct List head;			/* entry in global pool_list */
 	struct List map_head;			/* entry in user->pool_list */
 
-	PgDatabase *db;			/* corresponging database */
+	PgDatabase *db;			/* corresponding database */
 	PgUser *user;			/* user logged in as */
 
 	struct StatList active_client_list;	/* waiting events logged in clients */
@@ -244,7 +244,7 @@ struct PgPool {
  * first(db->forced_user->pool_list), where pool_list has only one entry.
  *
  * Otherwise, ->pool_list contains multiple pools, for all PgDatabases
- * whis user has logged in.
+ * which user has logged in.
  */
 struct PgUser {
 	struct List head;		/* used to attach user to list */
@@ -352,7 +352,7 @@ struct PgSocket {
 #define tmp_sk_linkfd	query_start
 /* takeover_clean_socket() needs to clean those up */
 
-/* where the salt is temporarly stored */
+/* where the salt is temporarily stored */
 #define tmp_login_salt  cancel_key
 
 /* main.c */
diff --git a/src/admin.c b/src/admin.c
index 4473b81..5af9ec3 100644
--- a/src/admin.c
+++ b/src/admin.c
@@ -928,7 +928,7 @@ static bool admin_cmd_shutdown(PgSocket *admin, const char *arg)
 
 	/*
 	 * note: new pooler expects unix socket file gone when it gets
-	 * event from fd.  currently atexit() cleanup should be called
+	 * event from fd.  Currently atexit() cleanup should be called
 	 * before closing open sockets.
 	 */
 	log_info("SHUTDOWN command issued");
@@ -1293,7 +1293,7 @@ bool admin_handle_client(PgSocket *admin, PktHdr *pkt)
 	const char *q;
 	bool res;
 
-	/* dont tolerate partial packets */
+	/* don't tolerate partial packets */
 	if (incomplete_pkt(pkt)) {
 		disconnect_client(admin, true, "incomplete pkt");
 		return false;
diff --git a/src/client.c b/src/client.c
index 8eff818..c8a2574 100644
--- a/src/client.c
+++ b/src/client.c
@@ -362,7 +362,7 @@ static bool decide_startup_pool(PgSocket *client, PktHdr *pkt)
 	if (!dbname || !dbname[0])
 		dbname = username;
 
-	/* check if limit allows, dont limit admin db
+	/* check if limit allows, don't limit admin db
 	   nb: new incoming conn will be attached to PgSocket, thus
 	   get_active_client_count() counts it */
 	if (get_active_client_count() > cf_max_client_conn) {
@@ -507,7 +507,7 @@ static bool handle_client_work(PgSocket *client, PktHdr *pkt)
 		if (client->pool->db->admin)
 			return admin_handle_client(client, pkt);
 
-		/* aquire server */
+		/* acquire server */
 		if (!find_server(client))
 			return false;
 
diff --git a/src/janitor.c b/src/janitor.c
index 167a62e..c6c47fd 100644
--- a/src/janitor.c
+++ b/src/janitor.c
@@ -235,7 +235,7 @@ static int per_loop_suspend(PgPool *pool, bool force_suspend)
 
 	active += suspend_socket_list(&pool->active_client_list, force_suspend);
 
-	/* this list is unsuspendable, but still need force_suspend and counting */
+	/* this list is not suspendable, but still need force_suspend and counting */
 	active += suspend_socket_list(&pool->waiting_client_list, force_suspend);
 	if (active)
 		per_loop_activate(pool);
@@ -598,7 +598,7 @@ skip_maint:
 	safe_evtimer_add(&full_maint_ev, &full_maint_period);
 }
 
-/* first-time initializtion */
+/* first-time initialization */
 void janitor_setup(void)
 {
 	/* launch maintenance */
diff --git a/src/loader.c b/src/loader.c
index 5a4ad67..9496084 100644
--- a/src/loader.c
+++ b/src/loader.c
@@ -40,7 +40,7 @@ static char *cstr_skip_ws(char *p)
 	return p;
 }
 
-/* parse paramenter name before '=' */
+/* parse parameter name before '=' */
 static char *cstr_get_key(char *p, char **dst_p)
 {
 	char *end;
@@ -104,7 +104,7 @@ static char *cstr_get_value(char *p, char **dst_p)
 }
 
 /*
- * Get key=val pair from connstring.  returns position it stopped
+ * Get key=val pair from connstring.  Returns position it stopped
  * or NULL on error.  EOF is signaled by *key = 0.
  */
 static char * cstr_get_pair(char *p,
diff --git a/src/main.c b/src/main.c
index d978bf1..1cd5f3e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,7 @@
  */
 
 /*
- * Launcer for all the rest.
+ * Launcher for all the rest.
  */
 
 #include "bouncer.h"
@@ -317,7 +317,7 @@ void load_config(void)
 		die("Cannot load config file");
 	} else {
 		log_warning("Config file loading failed");
-		/* if ini file missing, dont kill anybody */
+		/* if ini file missing, don't kill anybody */
 		set_dbs_dead(false);
 	}
 
@@ -454,7 +454,7 @@ static void go_daemon(void)
 	if (!cf_pidfile[0])
 		fatal("daemon needs pidfile configured");
 
-	/* dont log to stdout anymore */
+	/* don't log to stdout anymore */
 	cf_quiet = 1;
 
 	/* send stdin, stdout, stderr to /dev/null */
diff --git a/src/objects.c b/src/objects.c
index 7ce1566..ec80d10 100644
--- a/src/objects.c
+++ b/src/objects.c
@@ -637,8 +637,8 @@ static bool reuse_on_release(PgSocket *server)
 
 		/*
 		 * As the activate_client() does full read loop,
-		 * then it may happen that linked client close
-		 * couses server close.  Report it.
+		 * then it may happen that linked client closing
+		 * causes server closing.  Report it.
 		 */
 		if (server->state == SV_FREE || server->state == SV_JUSTFREE)
 			res = false;
diff --git a/src/pooler.c b/src/pooler.c
index 906b7e4..42902df 100644
--- a/src/pooler.c
+++ b/src/pooler.c
@@ -202,7 +202,7 @@ static void create_unix_socket(const char *socket_dir, int listen_port)
  *
  * Related to tcp_synack_retries sysctl, default 5 (corresponds 180 secs).
  *
- * SO_ACCEPTFILTER needs to be set after listern(), maybe TCP_DEFER_ACCEPT too.
+ * SO_ACCEPTFILTER needs to be set after listen(), maybe TCP_DEFER_ACCEPT too.
  */
 static void tune_accept(int sock, bool on)
 {
diff --git a/src/proto.c b/src/proto.c
index f793998..ad1e039 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -61,7 +61,7 @@ bool get_header(struct MBuf *data, PktHdr *pkt)
 			log_noise("get_header: unknown special pkt");
 			return false;
 		}
-		/* dont tolerate partial pkt */
+		/* don't tolerate partial pkt */
 		if (mbuf_avail_for_read(&hdr) < OLD_HEADER_LEN - 2) {
 			log_noise("get_header: less than 8 bytes for special pkt");
 			return false;
diff --git a/src/sbuf.c b/src/sbuf.c
index f481a47..b9559d5 100644
--- a/src/sbuf.c
+++ b/src/sbuf.c
@@ -547,7 +547,7 @@ static bool sbuf_actual_recv(SBuf *sbuf, unsigned len)
 		sbuf_call_proto(sbuf, SBUF_EV_RECV_FAILED);
 		return false;
 	} else if (got < 0 && errno != EAGAIN) {
-		/* some error occured */
+		/* some error occurred */
 		sbuf_call_proto(sbuf, SBUF_EV_RECV_FAILED);
 		return false;
 	}
diff --git a/src/server.c b/src/server.c
index dac4867..b8f63e4 100644
--- a/src/server.c
+++ b/src/server.c
@@ -246,7 +246,7 @@ static bool handle_server_work(PgSocket *server, PktHdr *pkt)
 
 	/*
 	 * 'E' and 'N' packets currently set ->ready to 0.  Correct would
-	 * be to leave ->ready as-is, because overal TX state stays same.
+	 * be to leave ->ready as-is, because overall TX state stays same.
 	 * It matters for connections in IDLE or USED state which get dirty
 	 * suddenly but should not as they are still usable.
 	 *
diff --git a/src/system.c b/src/system.c
index 5425f21..20ac556 100644
--- a/src/system.c
+++ b/src/system.c
@@ -99,7 +99,7 @@ void change_file_mode(const char *fn, mode_t mode,
 		} else {
 			gr = getgrnam(group_name);
 			if (!gr)
-				fatal("cound not find group '%s': %s",
+				fatal("could not find group '%s': %s",
 				      group_name, strerror(errno));
 			gid = gr->gr_gid;
 		}
diff --git a/src/util.c b/src/util.c
index 79856f2..1c761c3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -183,7 +183,7 @@ loop:
 
 	/* move listpos further */
 	listpos = p + len;
-	/* survive len=0 and avoid unneccesary compare */
+	/* survive len=0 and avoid unnecessary compare */
 	if (*listpos)
 		listpos++;
 
diff --git a/src/varcache.c b/src/varcache.c
index 7a795cd..6321dc5 100644
--- a/src/varcache.c
+++ b/src/varcache.c
@@ -124,7 +124,7 @@ bool varcache_apply(PgSocket *server, PgSocket *client, bool *changes_p)
 
 	pktbuf_start_packet(pkt, 'Q');
 
-	/* grab quory position inside pkt */
+	/* grab query position inside pkt */
 	sql_ofs = pktbuf_written(pkt);
 
 	for (lk = lookup; lk->name; lk++) {
diff --git a/test/asynctest.c b/test/asynctest.c
index 00f5e6e..74b2204 100644
--- a/test/asynctest.c
+++ b/test/asynctest.c
@@ -213,7 +213,7 @@ static void conn_error(DbConn *db, const char *desc)
 }
 
 /*
- * Connection has a resultset avalable, fetch it.
+ * Connection has a resultset available, fetch it.
  *
  * Returns true if there may be more results coming,
  * false if all done.
-- 
2.39.5

