Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays - Mailing list pgsql-hackers

From Chao Li
Subject Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays
Date
Msg-id CAEoWx2m1Vo97Jg9=K7JAZ0xdkg5D=GkgOxZR1=EW7mUfy008fw@mail.gmail.com
Whole thread Raw
Responses Re: Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays
List pgsql-hackers
Hi Hackers,

I noticed this error while working on [1].

In BufFile, the fields is claimed as an array:
```
struct BufFile
{
    File *files; /* palloc'd array with numFiles entries */
```

However, it’s allocated by palloc_object():
```
file->files = palloc_object(File);
```

And reallocated by repalloc():
```
    file->files = (File *) repalloc(file->files,
        (file->numFiles + 1) * sizeof(File));
```

This trivial patch just changes to use palloc_array/repalloc_array, which makes the intent clearer.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Attachment

pgsql-hackers by date:

Previous
From: Zshengbin91
Date:
Subject: improve comments on CreateFunction returnsSet
Next
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: doc: update the default of data checksums in the doc of pg_rewind