Re: jsonapi type fixups

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonapi type fixups
Date: 2024-06-20 12:05:14
Message-ID: 0a440c8c-6419-4c27-aac1-c64efb580cc9@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2024-06-18 Tu 7:48 AM, Peter Eisentraut wrote:
> I have this patch series that fixes up the types of the new
> incremental JSON API a bit.  Specifically, it uses "const" throughout
> so that the top-level entry points such as pg_parse_json_incremental()
> can declare their arguments as const char * instead of just char *. 
> This just works, it doesn't require any new casting tricks.  In fact,
> it removes a few unconstify() calls.
>
> Also, a few arguments and variables that relate to object sizes should
> be size_t rather than int.  At this point, this mainly makes the API
> better self-documenting.  I don't think it actually works to parse
> larger than 2 GB chunks (not tested).

I think this is mostly OK.

The change at line 1857 of jsonapi.c looks dubious, though. The pointer
variable p looks anything but constant. Perhaps I'm misunderstanding.

It would also be nice to reword the comment at line 3142 of jsonfuncs.c,
so it can still fit on one line.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2024-06-20 12:14:17 Re: confusing valgrind report about tuplestore+wrapper_handler (?) on 32-bit arm
Previous Message Tomas Vondra 2024-06-20 11:54:08 Re: confusing valgrind report about tuplestore+wrapper_handler (?) on 32-bit arm