Why repalloc() != realloc() ?

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Why repalloc() != realloc() ?
Date: 2004-06-02 02:57:18
Message-ID: 20040602025718.GA518@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

Is there a reason why repalloc() does not behave the same as realloc?
realloc(NULL, size) behaves the same as malloc(size), and it seems
useful behavior -- I wonder why repalloc() chooses to Assert() against
this exact condition?

I assume this is because the NULL pointer would not know what context it
belongs to, but the obvious answer is CurrentMemoryContext just like
palloc() does. So there must be another reason.

Can this behavior be changed?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Para tener más hay que desear menos"

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-06-02 03:00:03 Re: Converting postgresql.conf parameters to kilobytes
Previous Message Andrew Dunstan 2004-06-02 02:15:32 Re: Official Freeze Date for 7.5: July 1st, 2004