PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ geography_send()

Datum geography_send ( PG_FUNCTION_ARGS  )

Definition at line 635 of file geography_inout.c.

636 {
637  LWGEOM *lwgeom = NULL;
638  GSERIALIZED *g = NULL;
639  size_t size_result;
640  uint8_t *wkb;
641  bytea *result;
642 
643  g = PG_GETARG_GSERIALIZED_P(0);
644  lwgeom = lwgeom_from_gserialized(g);
645  wkb = lwgeom_to_wkb(lwgeom, WKB_EXTENDED, &size_result);
646  lwgeom_free(lwgeom);
647 
648  result = palloc(size_result + VARHDRSZ);
649  SET_VARSIZE(result, size_result + VARHDRSZ);
650  memcpy(VARDATA(result), wkb, size_result);
651  lwfree(wkb);
652 
653  PG_RETURN_POINTER(result);
654 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.
Definition: lwout_wkb.c:790
void lwfree(void *mem)
Definition: lwutil.c:242
#define WKB_EXTENDED
Definition: liblwgeom.h:2123

References lwfree(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_to_wkb(), and WKB_EXTENDED.

Here is the call graph for this function: