Avoid defining variable-length arrays

As of PostgreSQL commit d9dd406f, variable length arrays are no longer
permitted. As they're not actually required anyway, just define appropriate
constants.

Also noted in GitHub #510.
This commit is contained in:
Ian Barwick
2018-10-26 10:09:45 +09:00
parent 4f0b10cac6
commit a554914854
2 changed files with 7 additions and 5 deletions

View File

@@ -58,7 +58,7 @@
#define TRANCHE_NAME "repmgrd"
#define REPMGRD_STATE_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "/repmgrd_state.txt"
#define REPMGRD_STATE_FILE_BUF_SIZE 128
PG_MODULE_MAGIC;
@@ -256,8 +256,8 @@ set_local_node_id(PG_FUNCTION_ARGS)
if (file != NULL)
{
int buffer_size = 128;
char buffer[buffer_size];
int buffer_size = REPMGRD_STATE_FILE_BUF_SIZE;
char buffer[REPMGRD_STATE_FILE_BUF_SIZE];
if (fgets(buffer, buffer_size, file) != NULL)
{