From: Christoph Berg Date: Sun, 2 Sep 2018 11:34:54 +0000 (+0200) Subject: Use sizeof(PageHeaderData) in place of pageHeaderSize X-Git-Tag: REL_11_0~1 X-Git-Url: http://git.postgresql.org/gitweb/static/backend_dirs.html?a=commitdiff_plain;h=25815e884a6987f25f3976c242f958bd18f0c118;p=pg_filedump.git Use sizeof(PageHeaderData) in place of pageHeaderSize With -Werror=vla, gcc complains about the localCache declaration. Instead of the pageHeaderSize variable, use sizeof(PageHeaderData) directly like elsewhere in this file. pg_filedump.c:648:2: error: ISO C90 forbids array ‘localCache’ whose size can’t be evaluated [-Werror=vla] --- diff --git a/pg_filedump.c b/pg_filedump.c index fc6ce4b..a5b75f3 100644 --- a/pg_filedump.c +++ b/pg_filedump.c @@ -642,16 +642,15 @@ GetOptionValue(char *optionString) unsigned int GetBlockSize(FILE *fp) { - unsigned int pageHeaderSize = sizeof(PageHeaderData); unsigned int localSize = 0; int bytesRead = 0; - char localCache[pageHeaderSize]; + char localCache[sizeof(PageHeaderData)]; /* Read the first header off of block 0 to determine the block size */ - bytesRead = fread(&localCache, 1, pageHeaderSize, fp); + bytesRead = fread(&localCache, 1, sizeof(PageHeaderData), fp); rewind(fp); - if (bytesRead == pageHeaderSize) + if (bytesRead == sizeof(PageHeaderData)) localSize = (unsigned int) PageGetPageSize(&localCache); else {