summaryrefslogtreecommitdiff
path: root/contrib/datetime/datetime_functions.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-01-07 18:47:07 +0000
committerBruce Momjian <bruce@momjian.us>1998-01-07 18:47:07 +0000
commite6c6146eb8129f1ea1e1f68ef739c13824357225 (patch)
tree87cb303b9803a3494e74ca7efc760ed6187c667d /contrib/datetime/datetime_functions.c
parent7a2a7d436dac73e2b983224458887749078e9796 (diff)
Allow varchar() to only store needed bytes. Remove PALLOC,PALLOCTYPE,PFREE. Clean up use of VARDATA.
Diffstat (limited to 'contrib/datetime/datetime_functions.c')
-rw-r--r--contrib/datetime/datetime_functions.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/datetime/datetime_functions.c b/contrib/datetime/datetime_functions.c
index b96761bc8f8..4c8d11794cb 100644
--- a/contrib/datetime/datetime_functions.c
+++ b/contrib/datetime/datetime_functions.c
@@ -66,7 +66,7 @@ hhmm_in(char *str)
elog(ERROR,"Second must be limited to values 0 through < 60 in '%s'",
str);
- time = PALLOCTYPE(TimeADT);
+ time = palloc(sizeof(TimeADT));
*time = ((((tm->tm_hour*60)+tm->tm_min)*60));
@@ -99,7 +99,7 @@ hhmm_out(TimeADT *time)
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
}
- result = PALLOC(strlen(buf)+1);
+ result = palloc(strlen(buf)+1);
strcpy( result, buf);
@@ -109,7 +109,7 @@ hhmm_out(TimeADT *time)
TimeADT *
hhmm(TimeADT *time)
{
- TimeADT *result = PALLOCTYPE(TimeADT);
+ TimeADT *result = palloc(sizeof(TimeADT));
*result = (((int) *time) / 60 * 60);
@@ -119,7 +119,7 @@ hhmm(TimeADT *time)
TimeADT *
time_difference(TimeADT *time1, TimeADT *time2)
{
- TimeADT *time = PALLOCTYPE(TimeADT);
+ TimeADT *time = palloc(sizeof(TimeADT));
*time = (*time1 - *time2);
return(time);
@@ -188,7 +188,7 @@ date_year(DateADT val)
TimeADT *
currenttime()
{
- TimeADT *result = PALLOCTYPE(TimeADT);
+ TimeADT *result = palloc(sizeof(TimeADT));
struct tm *tm;
time_t current_time;