1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +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:
Tom Lane
2010-04-28 16:54:16 +00:00
parent 5f70a04c56
commit 77acab75df
12 changed files with 87 additions and 112 deletions

View File

@ -14,7 +14,7 @@
* Copyright (c) 2008-2010, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/contrib/pg_stat_statements/pg_stat_statements.c,v 1.13 2010/02/26 02:00:32 momjian Exp $
* $PostgreSQL: pgsql/contrib/pg_stat_statements/pg_stat_statements.c,v 1.14 2010/04/28 16:54:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -321,8 +321,6 @@ pgss_shmem_startup(void)
pgss = ShmemInitStruct("pg_stat_statements",
sizeof(pgssSharedState),
&found);
if (!pgss)
elog(ERROR, "out of shared memory");
if (!found)
{
@ -343,8 +341,6 @@ pgss_shmem_startup(void)
pgss_max, pgss_max,
&info,
HASH_ELEM | HASH_FUNCTION | HASH_COMPARE);
if (!pgss_hash)
elog(ERROR, "out of shared memory");
LWLockRelease(AddinShmemInitLock);