Re: safer node casting
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-02-21T17:00:55Z
Lists: pgsql-hackers
On 1/26/17 16:15, Andres Freund wrote: > On 2017-01-25 19:21:40 -0500, Tom Lane wrote: >> Andres Freund <andres@anarazel.de> writes: >>> On 2016-12-31 12:08:22 -0500, Peter Eisentraut wrote: >>>> RestrictInfo *rinfo = castNode(RestrictInfo, lfirst(lc)); >> >>> Are you planning to add this / update this patch? Because I really would >>> have liked this a number of times already... I can update it according >>> to my suggestions (to avoid multiple eval scenarios) if helpful >> >> Yeah, I'd like that in sooner rather than later, too. But we do need >> it to be foolproof - no multiple evals. The first draft had >> inadequate-parenthesization hazards, > > How about something like the attached? The first patch just contains > castNode(), the second one a rebased version of Peter's changes (with > some long lines broken up). Thanks for finishing that up. I have committed more uses that I had lying around partially done. Looks nice now. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Suppress unused-variable warning.
- c56ac2913a1f 10.0 landed
-
Make more use of castNode()
- 38d103763d14 10.0 cited
-
Add castNode(type, ptr) for safe casting between NodeTag based types.
- 1ad163ef0130 9.3.16 landed
- 14d0e290cbe7 9.2.20 landed
- cf8c86af950b 9.4.11 landed
- 8fef0c34143b 9.5.6 landed
- 5bcab111426e 10.0 landed
- 574b091e5835 9.6.2 landed
-
Use the new castNode() macro in a number of places.
- 9ba8a9ce4548 10.0 landed