[GENERAL] Defining input function for new datatype

2011-04-21 Thread Nick Raj
Hi, I am defining a new data type called mpoint i.e. typedef struct mpoint { Point p; Timestamp t; } mpoint; For defining input/output function 1 Datum mpoint_in(PG_FUNCTION_ARGS) 2 { 3 4mpoint *result; 5char *pnt=(char *)malloc (sizeof (20)); 6char

Re: [GENERAL] Defining input function for new datatype

2011-04-21 Thread Tom Lane
Nick Raj nickrajj...@gmail.com writes: 1 Datum mpoint_in(PG_FUNCTION_ARGS) 2 { 3 4mpoint *result; 5char *pnt=(char *)malloc (sizeof (20)); 6char *ts=(char *)malloc (sizeof (20)); (1) You should *not* use malloc here. There is seldom any reason to use malloc