pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: Unportable code in autoprewarm.c
Date: Wed, 02 May 2018 15:21:49 -0400
Message-ID: <7773.1525288909@sss.pgh.pa.us> (raw)

I've been going through compiler warnings from the buildfarm, and
I notice jacana is unhappy about this:

	/* First line of the file is a record count. */
	if (fscanf(file, "<<" INT64_FORMAT ">>\n", &num_elements) != 1)

It's entirely correct to complain, because we only guarantee that
INT64_FORMAT works with snprintf, not with the scanf family of
functions.

Is there a reason why this record count needs to be int64 rather than
plain int, and if so what?  This code is not exactly well documented,
but it looks to me like the number of records should be bounded by
NBuffers, which is an int and is unlikely ever to not be an int.
So I'm inclined to just flush autoprewarm.c's use of int64 counters
altogether.

			regards, tom lane




view thread (2+ messages)  latest in thread

Message-ID: <7773.1525288909@sss.pgh.pa.us>
Permalink:  ../7773.1525288909@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7773.1525288909@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: Unportable code in autoprewarm.c
  In-Reply-To: <7773.1525288909@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox