Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build time_t for 32-bits #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/utils/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ extern "C"
/* pgpool-II extensions */
json_value *json_get_value_for_key(json_value * source, const char *key);
int json_get_int_value_for_key(json_value * source, const char *key, int *value);
int json_get_long_value_for_key(json_value * source, const char *key, long *value);
int json_get_long_value_for_key(json_value * source, const char *key, time_t *value);
char *json_get_string_value_for_key(json_value * source, const char *key);
int json_get_bool_value_for_key(json_value * source, const char *key, bool *value);

Expand Down
4 changes: 2 additions & 2 deletions src/include/watchdog/wd_json_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ extern bool parse_node_status_json(char *json_data, int data_len, int *nodeID, i


extern bool parse_beacon_message_json(char *json_data, int data_len, int *state,
long *seconds_since_node_startup,
long *seconds_since_current_state,
time_t *seconds_since_node_startup,
time_t *seconds_since_current_state,
int *quorumStatus,
int *standbyNodesCount,
bool *escalated);
Expand Down
2 changes: 2 additions & 0 deletions src/parser/snprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include "pool_parser.h"
#include "stringinfo.h"
#include "utils/palloc.h"
#include "postgresql/16/server/postgres_fe.h"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it brings warning and is not good approach

gcc -DHAVE_CONFIG_H -I. -I../../src/include  -D_GNU_SOURCE -I ../../src/include/parser -I /usr/include/postgresql   -Os -fstack-clash-protection -Wformat -Werror=format-security -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-format-truncation -Wno-stringop-truncation -fno-strict-aliasing -c -o snprintf.o snprintf.c
snprintf.c:79:9: warning: "MemSet" redefined
   79 | #define MemSet(start, val, len) \
      |         ^~~~~~
In file included from /usr/include/postgresql/16/server/postgres_fe.h:25,
                 from snprintf.c:50:
/usr/include/postgresql/16/server/c.h:1004:9: note: this is the location of the previous definition
 1004 | #define MemSet(start, val, len) \
      |         ^~~~~~
rm -f libsql-parser.a


/*
* We used to use the platform's NL_ARGMAX here, but that's a bad idea,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ json_get_int_value_for_key(json_value * source, const char *key, int *value)
}

int
json_get_long_value_for_key(json_value * source, const char *key, long *value)
json_get_long_value_for_key(json_value * source, const char *key, time_t *value)
{
json_value *jNode;

Expand Down
4 changes: 2 additions & 2 deletions src/watchdog/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -6654,8 +6654,8 @@ watchdog_state_machine_nw_isolation(WD_EVENTS event, WatchdogNode * wdNode, WDPa
static bool
beacon_message_received_from_node(WatchdogNode * wdNode, WDPacketData * pkt)
{
long seconds_since_node_startup;
long seconds_since_current_state;
time_t seconds_since_node_startup;
time_t seconds_since_current_state;
int quorum_status;
int standby_nodes_count;
bool escalated;
Expand Down
2 changes: 1 addition & 1 deletion src/watchdog/wd_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ get_wd_runtime_variable_value(char* wd_authkey, char *varName)

case VALUE_DATA_TYPE_LONG:
{
long longVal;
time_t longVal;

if (json_get_long_value_for_key(root, WD_JSON_KEY_VALUE_DATA, &longVal))
{
Expand Down
8 changes: 4 additions & 4 deletions src/watchdog/wd_json_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey)
if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
{
bool escalated;
long seconds_since_node_startup;
long seconds_since_current_state;
time_t seconds_since_node_startup;
time_t seconds_since_current_state;
struct timeval current_time;

gettimeofday(&current_time, NULL);
Expand Down Expand Up @@ -640,8 +640,8 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey)
bool
parse_beacon_message_json(char *json_data, int data_len,
int *state,
long *seconds_since_node_startup,
long *seconds_since_current_state,
time_t *seconds_since_node_startup,
time_t *seconds_since_current_state,
int *quorumStatus,
int *standbyNodesCount,
bool *escalated)
Expand Down