*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.149 2005/08/25 01:30:06 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.150 2005/08/25 03:53:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
Timestamp dt1 = PG_GETARG_TIMESTAMP(0);
Timestamp dt2 = PG_GETARG_TIMESTAMP(1);
- Interval *result, *result2;
+ Interval *result;
result = (Interval *) palloc(sizeof(Interval));
result->month = 0;
result->day = 0;
- result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
- pfree(result);
- PG_RETURN_INTERVAL_P(result2);
+ PG_RETURN_INTERVAL_P(result);
}
/* interval_justify_hours()
Interval *span = PG_GETARG_INTERVAL_P(0);
float8 factor = PG_GETARG_FLOAT8(1);
double month_remainder, day_remainder;
- Interval *result, *result2;
+ Interval *result;
result = (Interval *) palloc(sizeof(Interval));
day_remainder * SECS_PER_DAY);
#endif
- result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
- pfree(result);
- PG_RETURN_INTERVAL_P(result2);
+ PG_RETURN_INTERVAL_P(result);
}
Datum
Interval *span = PG_GETARG_INTERVAL_P(0);
float8 factor = PG_GETARG_FLOAT8(1);
double month_remainder, day_remainder;
- Interval *result, *result2;
+ Interval *result;
result = (Interval *) palloc(sizeof(Interval));
result->time = JROUND(result->time);
#endif
- result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
- pfree(result);
- PG_RETURN_INTERVAL_P(result2);
+ PG_RETURN_INTERVAL_P(result);
}
/*