mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Modify ShmemInitStruct and ShmemInitHash to throw errors internally,
rather than returning NULL for some-but-not-all failures as they used to. Remove now-redundant tests for NULL from call sites. We had to do something about this because many call sites were failing to check for NULL; and changing it like this seems a lot more useful and mistake-proof than adding checks to the call sites without them.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.217 2010/02/26 02:01:01 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.218 2010/04/28 16:54:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -756,21 +756,22 @@ AuxiliaryProcKill(int code, Datum arg)
|
||||
/*
|
||||
* ProcQueueAlloc -- alloc/attach to a shared memory process queue
|
||||
*
|
||||
* Returns: a pointer to the queue or NULL
|
||||
* Side Effects: Initializes the queue if we allocated one
|
||||
* Returns: a pointer to the queue
|
||||
* Side Effects: Initializes the queue if it wasn't there before
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
PROC_QUEUE *
|
||||
ProcQueueAlloc(char *name)
|
||||
ProcQueueAlloc(const char *name)
|
||||
{
|
||||
PROC_QUEUE *queue;
|
||||
bool found;
|
||||
PROC_QUEUE *queue = (PROC_QUEUE *)
|
||||
ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
|
||||
|
||||
if (!queue)
|
||||
return NULL;
|
||||
queue = (PROC_QUEUE *)
|
||||
ShmemInitStruct(name, sizeof(PROC_QUEUE), &found);
|
||||
|
||||
if (!found)
|
||||
ProcQueueInit(queue);
|
||||
|
||||
return queue;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user