From de883a4c843a3631732e4ae2f3e8acd73012249e Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Sun, 16 Sep 2012 02:10:02 -0500 Subject: [PATCH] Keep compiler quiet. Noted when compiling in FreeBSD in which i get a warning for an uninitialized variable. Also, define InvalidXLogRecPtr. We don't really need it but using it make the initialization future proof (considering that in 9.3 XLogRecPtr will change its structure). --- repmgrd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/repmgrd.c b/repmgrd.c index 8bc47d38..2c624858 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -35,6 +35,15 @@ #include "access/xlogdefs.h" #include "libpq/pqsignal.h" +/* + * we do not export InvalidXLogRecPtr so we need to define it + * but since 9.3 it will be defined in xlogdefs.h which we include + * so better to ask if it's defined to be future proof + */ +#ifndef InvalidXLogRecPtr +const XLogRecPtr InvalidXLogRecPtr = {0, 0}; +#endif + /* * Struct to keep info about the nodes, used in the voting process in * do_failover() @@ -582,7 +591,8 @@ do_failover(void) * which seems to be large enough for most scenarios */ nodeInfo nodes[50]; - nodeInfo best_candidate; + /* initialize to keep compiler quiet */ + nodeInfo best_candidate = {-1, InvalidXLogRecPtr, false }; /* first we get info about this node, and update shared memory */ sprintf(sqlquery, "SELECT pg_last_xlog_replay_location()");