Craig Ringer <craig@2ndquadrant.com> writes:
> I didn't have any way to make
> seg_l = (SEG *) DatumGetPointer(DirectFunctionCall2(seg_union,
> PointerGetDatum(seg_l),
> PointerGetDatum(sort_items[i].data)));
> pretty, but *shrug*.
For the builtin types, fmgr.h generally defines a datum-to-specific-
pointer-type macro, eg it has these for bytea:
#define DatumGetByteaP(X) ((bytea *) PG_DETOAST_DATUM(X))
#define PG_GETARG_BYTEA_P(n) DatumGetByteaP(PG_GETARG_DATUM(n))
(A type that doesn't have toast support would just use DatumGetPointer
instead of PG_DETOAST_DATUM.) Replacing "(SEG *) DatumGetPointer(...)"
with "DatumGetSegP(...)" would help a little here.
I wouldn't necessarily do that if this is the only place that would
benefit, but there might be more scope for upgrading seg.c's notation
than just here.
regards, tom lane