File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.58 2003/08/04 02:40:03 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.59 2003/08/17 22:41:12 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -76,8 +76,10 @@ InitLockTable(int maxBackends)
76
76
{
77
77
int lockmethod ;
78
78
79
+ /* number of lock modes is lengthof()-1 because of dummy zero */
79
80
lockmethod = LockMethodTableInit ("LockTable" ,
80
- LockConflicts , MAX_LOCKMODES - 1 ,
81
+ LockConflicts ,
82
+ lengthof (LockConflicts ) - 1 ,
81
83
maxBackends );
82
84
LockTableId = lockmethod ;
83
85
Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.126 2003/08/04 02:40:03 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.127 2003/08/17 22:41:12 tgl Exp $
12
12
*
13
13
* NOTES
14
14
* Outside modules can create a lock table and acquire/release
@@ -212,8 +212,8 @@ LockMethodInit(LOCKMETHODTABLE *lockMethodTable,
212
212
int i ;
213
213
214
214
lockMethodTable -> numLockModes = numModes ;
215
- numModes ++ ;
216
- for (i = 0 ; i < numModes ; i ++ , conflictsP ++ )
215
+ /* copies useless zero element as well as the N lockmodes */
216
+ for (i = 0 ; i <= numModes ; i ++ , conflictsP ++ )
217
217
lockMethodTable -> conflictTab [i ] = * conflictsP ;
218
218
}
219
219
@@ -241,11 +241,8 @@ LockMethodTableInit(char *tabName,
241
241
max_table_size ;
242
242
243
243
if (numModes >= MAX_LOCKMODES )
244
- {
245
- elog (WARNING , "too many lock types %d (limit is %d)" ,
246
- numModes , MAX_LOCKMODES );
247
- return INVALID_LOCKMETHOD ;
248
- }
244
+ elog (ERROR , "too many lock types %d (limit is %d)" ,
245
+ numModes , MAX_LOCKMODES - 1 );
249
246
250
247
/* Compute init/max size to request for lock hashtables */
251
248
max_table_size = NLOCKENTS (maxBackends );
You can’t perform that action at this time.
0 commit comments