Re: pg_dump vs malloc - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump vs malloc
Date
Msg-id 1401.1308757736@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump vs malloc  (Magnus Hagander <magnus@hagander.net>)
Responses Re: pg_dump vs malloc
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> Something along the line of this?

I think this is a seriously, seriously bad idea:

> +#define strdup(x) pg_strdup(x)
> +#define malloc(x) pg_malloc(x)
> +#define calloc(x,y) pg_calloc(x, y)
> +#define realloc(x,y) pg_realloc(x, y)

as it will render the code unreadable to people expecting the normal
behavior of these fundamental functions; not to mention break any
call sites that have some other means of dealing with an alloc failure
besides going belly-up.  Please take the trouble to do
s/malloc/pg_malloc/g and so on, instead.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: smallserial / serial2
Next
From: Peter Geoghegan
Date:
Subject: Re: pg_dump vs malloc