pgpool2.git / summary / log / commit / refs
commit 4d462fd01611ae05c124fc9466022c3496cabf2b
Author: Muhammad Usama <m.usama@gmail.com>
Date: Fri Apr 14 15:16:45 2017 +0000
Fix for some more code warnings.
uint64 definition was not uniform across the code.
src/include/pcp/libpcp_ext.h | 12 +++++++++++-
src/include/pool.h | 1 +
src/include/pool_config.h | 2 ++
src/include/pool_type.h | 12 +++---------
src/utils/pool_process_reporting.c | 4 ++--
5 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/include/pcp/libpcp_ext.h b/src/include/pcp/libpcp_ext.h
index a447dd53a..62bbe6b07 100644
--- a/src/include/pcp/libpcp_ext.h
+++ b/src/include/pcp/libpcp_ext.h
@@ -25,8 +25,11 @@
#ifndef LIBPCP_EXT_H
#define LIBPCP_EXT_H
+
+#include "pool_type.h"
#include <signal.h>
#include <stdio.h>
+
/*
* startup packet definitions (v2) stolen from PostgreSQL
*/
@@ -54,6 +57,13 @@ typedef enum {
#define BACKEND_STATUS_CON_UP "up"
#define BACKEND_STATUS_CON_DOWN "down"
+/*
+ * Backend status record file
+ */
+typedef struct {
+ BACKEND_STATUS status[MAX_NUM_BACKENDS];
+} BackendStatusRecord;
+
/*
* PostgreSQL backend descriptor. Placed on shared memory area.
*/
@@ -65,7 +75,7 @@ typedef struct {
double unnormalized_weight; /* descripted parameter */
char backend_data_directory[MAX_PATH_LENGTH];
unsigned short flag; /* various flags */
- unsigned long long int standby_delay; /* The replication delay against the primary */
+ uint64 standby_delay; /* The replication delay against the primary */
} BackendInfo;
typedef struct {
diff --git a/src/include/pool.h b/src/include/pool.h
index 5e64a6d10..40f425df2 100644
--- a/src/include/pool.h
+++ b/src/include/pool.h
@@ -28,6 +28,7 @@
#include "config.h"
#include "pool_type.h"
+#include "pcp/libpcp_ext.h"
#include "utils/pool_signal.h"
#include "parser/nodes.h"
diff --git a/src/include/pool_config.h b/src/include/pool_config.h
index 38f4bc88f..68e17b188 100644
--- a/src/include/pool_config.h
+++ b/src/include/pool_config.h
@@ -26,6 +26,8 @@
#ifndef POOL_CONFIG_H
#define POOL_CONFIG_H
+#include "pcp/libpcp_ext.h"
+
/*
* watchdog
*/
diff --git a/src/include/pool_type.h b/src/include/pool_type.h
index 5e70ed72e..34efbaf30 100644
--- a/src/include/pool_type.h
+++ b/src/include/pool_type.h
@@ -29,7 +29,6 @@
#include "config.h"
#include <sys/types.h>
#include <sys/socket.h>
-#include "pcp/libpcp_ext.h"
#include "libpq-fe.h"
/* Define common boolean type. C++ and BEOS already has it so exclude them. */
#ifdef c_plusplus
@@ -76,10 +75,13 @@ typedef unsigned int uint32; /* == 32 bits */
#ifdef HAVE_LONG_INT_64
/* Plain "long int" fits, use it */
typedef long int int64;
+typedef unsigned long int uint64;
+
#define pool_atoi64 atol
#elif defined(HAVE_LONG_LONG_INT_64)
/* We have working support for "long long int", use that */
typedef long long int int64;
+typedef unsigned long long int uint64;
#define pool_atoi64 atoll
#else
/* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
@@ -91,13 +93,6 @@ typedef enum {
LOAD_SELECTED
} LOAD_BALANCE_STATUS;
-/*
- * Backend status record file
- */
-typedef struct {
- BACKEND_STATUS status[MAX_NUM_BACKENDS];
-} BackendStatusRecord;
-
extern int assert_enabled;
extern void ExceptionalCondition(const char *conditionName,
const char *errorType,
@@ -215,7 +210,6 @@ typedef unsigned int AuthRequest;
typedef uint8 bits8; /* >= 8 bits */
typedef uint16 bits16; /* >= 16 bits */
typedef uint32 bits32; /* >= 32 bits */
-typedef unsigned long long int uint64;
/*
* stdint.h limits aren't guaranteed to be present and aren't guaranteed to
diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c
index f9cf44b92..2532f0967 100644
--- a/src/utils/pool_process_reporting.c
+++ b/src/utils/pool_process_reporting.c
@@ -902,7 +902,7 @@ POOL_REPORT_CONFIG* get_config(int *nrows)
i++;
snprintf(status[i].name, POOLCONFIG_MAXNAMELEN, "standby_delay%d", j);
- snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%lld", BACKEND_INFO(j).standby_delay);
+ snprintf(status[i].value, POOLCONFIG_MAXVALLEN, UINT64_FORMAT, BACKEND_INFO(j).standby_delay);
snprintf(status[i].desc, POOLCONFIG_MAXDESCLEN, "standby delay of backend #%d", j);
i++;
@@ -1150,7 +1150,7 @@ POOL_REPORT_NODES* get_nodes(int *nrows)
snprintf(nodes[i].port, POOLCONFIG_MAXPORTLEN, "%d", bi->backend_port);
snprintf(nodes[i].status, POOLCONFIG_MAXSTATLEN, "%s", backend_status_to_str(bi->backend_status));
snprintf(nodes[i].lb_weight, POOLCONFIG_MAXWEIGHTLEN, "%f", bi->backend_weight/RAND_MAX);
- snprintf(nodes[i].select, POOLCONFIG_MAXWEIGHTLEN, "%lld", stat_get_select_count(i));
+ snprintf(nodes[i].select, POOLCONFIG_MAXWEIGHTLEN, UINT64_FORMAT, stat_get_select_count(i));
snprintf(nodes[i].load_balance_node, POOLCONFIG_MAXWEIGHTLEN, "%s",
(session_context->load_balance_node_id == i)? "true":"false");
[parent: 69a7b8004c21]