*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.58 2003/08/04 02:40:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.59 2003/08/17 22:41:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
int lockmethod;
+ /* number of lock modes is lengthof()-1 because of dummy zero */
lockmethod = LockMethodTableInit("LockTable",
- LockConflicts, MAX_LOCKMODES - 1,
+ LockConflicts,
+ lengthof(LockConflicts) - 1,
maxBackends);
LockTableId = lockmethod;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.126 2003/08/04 02:40:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.127 2003/08/17 22:41:12 tgl Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
int i;
lockMethodTable->numLockModes = numModes;
- numModes++;
- for (i = 0; i < numModes; i++, conflictsP++)
+ /* copies useless zero element as well as the N lockmodes */
+ for (i = 0; i <= numModes; i++, conflictsP++)
lockMethodTable->conflictTab[i] = *conflictsP;
}
max_table_size;
if (numModes >= MAX_LOCKMODES)
- {
- elog(WARNING, "too many lock types %d (limit is %d)",
- numModes, MAX_LOCKMODES);
- return INVALID_LOCKMETHOD;
- }
+ elog(ERROR, "too many lock types %d (limit is %d)",
+ numModes, MAX_LOCKMODES-1);
/* Compute init/max size to request for lock hashtables */
max_table_size = NLOCKENTS(maxBackends);