Re: [HACKERS] Size vs size_t - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: [HACKERS] Size vs size_t
Date
Msg-id CAEepm=0y67tAMmVkpfMu0LR0_OunE9uOkJJZSVbqLW6WuLj-uw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Size vs size_t  (Andres Freund <andres@anarazel.de>)
Responses Re: [HACKERS] Size vs size_t  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Mar 17, 2017 at 10:39 AM, Andres Freund <andres@anarazel.de> wrote:
> On 2017-03-16 17:24:17 -0400, Tom Lane wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>> > On Thu, Mar 16, 2017 at 5:01 PM, Andres Freund <andres@anarazel.de> wrote:
>> >> On 2017-03-16 16:59:29 -0400, Robert Haas wrote:
>> > Well, I don't think we want to end up with a mix of Size and size_t in
>> > related code.  That buys nobody anything.  I'm fine with replacing
>> > Size with size_t if they are always equivalent, but there's no sense
>> > in having a jumble of styles.
>>
>> I'm not in a hurry to do "s/Size/size_t/g" because I'm afraid it'll create
>> a lot of merge pain for back-patching, while not actually buying anything
>> much concretely.  I think this falls under the same policy we use for many
>> other stylistic details, ie make new code look like the code right around
>> it.  But I'm fine with entirely-new files standardizing on size_t.
>
> That seems like sane policy.  I'm a bit doubtful that the pain would be
> all that bad, but I'm also not wild about trying.

Naive replacement in new files (present in master but not in 9.6) with
the attached script, followed by a couple of manual corrections where
Size was really an English word in a comment, gets the attached diff.

 src/backend/access/hash/hash_xlog.c        |  26 ++--
 src/backend/replication/logical/launcher.c |   4 +-
 src/backend/utils/misc/backend_random.c    |   4 +-
 src/backend/utils/mmgr/dsa.c               |  94 ++++++-------
 src/backend/utils/mmgr/freepage.c          | 202 ++++++++++++++--------------
 src/backend/utils/mmgr/slab.c              |  34 ++---
 src/include/lib/simplehash.h               |   6 +-
 src/include/replication/logicallauncher.h  |   2 +-
 src/include/utils/backend_random.h         |   2 +-
 src/include/utils/dsa.h                    |  10 +-
 src/include/utils/freepage.h               |  24 ++--
 src/include/utils/relptr.h                 |   4 +-
 12 files changed, 206 insertions(+), 206 deletions(-)

That might be just about enough for size_t to catch up...

-- 
Thomas Munro
http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Size vs size_t
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] multivariate statistics (v25)