Fix for some more code warnings.
authorMuhammad Usama <m.usama@gmail.com>
Fri, 14 Apr 2017 15:16:45 +0000 (20:16 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Fri, 14 Apr 2017 15:16:45 +0000 (20:16 +0500)
uint64 definition was not uniform across the code.

src/include/pcp/libpcp_ext.h
src/include/pool.h
src/include/pool_config.h
src/include/pool_type.h
src/utils/pool_process_reporting.c

index a447dd53a31235787222ec1f077eb1484db53a37..62bbe6b07e21393329455416f1c25f3f1f3dcf3c 100644 (file)
 
 #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 {
index 5e64a6d10d6e2c8b61f85bd64c0fc2cb07398e8a..40f425df2634f4f33e467ce6bf4ccbf5611f6cc2 100644 (file)
@@ -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"
 
index 38f4bc88ff4d333269e71f1a7d8e8d6a48a061e4..68e17b188d870c185f01b0bbb66c8c8c5a6d0735 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef POOL_CONFIG_H
 #define POOL_CONFIG_H
 
+#include "pcp/libpcp_ext.h"
+
 /*
  * watchdog
  */
index 5e70ed72e4d8ae633a1f5894d1d3a2a96311220c..34efbaf3016a18ecbec4de098642403bb82817ff 100644 (file)
@@ -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
index f9cf44b92dc7190bf0e69b3a3e25cbd2048858f0..2532f09675a816dc51ab52a1bb0f4fbac2ab4738 100644 (file)
@@ -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");