From: | "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: [GENERAL] backend crashing despite tsearch2 patch |
Date: | 2003-09-18 09:35:11 |
Message-ID: | Pine.LNX.4.21.0309181033520.14653-100000@ponder.fairway2k.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I'll withdraw this particular patch and resubmit later on.
(Sorry for the individual reply Tom, I hit the wrong keys before noticing)
Nigel
On Thu, 18 Sep 2003, Nigel J. Andrews wrote:
> On Thu, 18 Sep 2003, Tom Lane wrote:
>
> > "Nigel J. Andrews" <nandrews(at)investsystems(dot)co(dot)uk> writes:
> > > On a matter of style, it's been a while since I've seriously considered cross
> > > platform C. Is it the done thing to expect:
> > > int *i = (int *)calloc(1,sizeof(int));
> > > to give the condition *i == 0 (assuming the memory allocation worked)?
> >
> > calloc is defined to zero out the block of memory it returns (as opposed
> > to malloc which may return a block containing any random junk).
>
> I was thinking more of any odd cpu that might be around which, for some strange
> reason, doesn't read, for example 32 bits of zero as an integer of zero.
> Obviously it's probably taking paranoid programming to an extreme and in the
> real world probably not worth worrying about but there's always a chance.
>
> >
> > A more serious question is whether any of this code should be using
> > calloc/malloc as opposed to palloc. I'd prefer to see it rewritten to
> > use palloc wherever possible; but that begs the question of what the
> > required lifespan of the allocations is.
>
> I wasn't sure of the life time needed and in the interests of not making
> changes that broke a workign arrangment I left it not using palloc.
>
> >
> > + #ifndef NULL
> > + #define NULL ((void *)0)
> > + #endif
> >
> > It has been roughly twenty years since a C platform existed that didn't
> > predefine NULL ... and the ones that did not would likely not recognize
> > the ANSI-C-ism "void *". So the above is unhelpful by any measure.
>
> Fair point. I didn't include postgres.h on purpose, again to avoid introducing
> new things that broke an existing working arrangement. Obviously I didn't pay
> too much attention to the portability of what I did put in.
>
> I'll take another look at this tonight, along with the formating style used,
> which I see has been made more normal looking in cvs head.
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-09-19 19:57:42 | pgsql-server/src/backend catalog/index.c comma ... |
Previous Message | Tom Lane | 2003-09-18 04:21:40 | Re: [PATCHES] backend crashing despite tsearch2 patch |