use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()` - Mailing list pgsql-hackers

From 盏一
Subject use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`
Date
Msg-id tencent_5624AA3B116B3D1C31CA9744@qq.com
Whole thread Raw
Responses Re: use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`
List pgsql-hackers
Hi,

Since we have introduced `pgxactoff` in
[941697c3c1ae5d6ee153065adb96e1e63ee11224](https://github.com/postgres/postgres/commit/941697c3c1ae5d6ee153065adb96e1e63ee11224),
and`pgxactoff` is always the index of `proc->pgprocno` in `procArray->pgprocnos`. So it seems that we could directly
use`proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`? My thought is to replace 
 

```c
for (index = 0; index < arrayP->numProcs; index++)
{
  if (arrayP->pgprocnos[index] == proc->pgprocno)
  {
      /* ... */
  }
}
```

with 

```c
index = proc->pgxactoff;
/* ... */
```

I would appreciate your help.

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Small issues with CREATE TABLE COMPRESSION
Next
From: Isaac Morland
Date:
Subject: Re: COPY table_name (single_column) FROM 'iso-8859-1.txt' DELIMITER E'\n'