| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Make use of pg_memory_is_all_zeros() in more places |
| Date: | 2024-12-11 06:03:34 |
| Message-ID: | Z1krNmlfzcRDd_GX@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Dec 10, 2024 at 02:18:33PM +0000, Bertrand Drouvot wrote:
> While searching for memcmp() calls in "*stat*.c" files (due to [1]), it appeared
> that we could $SUBJECT. Please find attached a patch doing so.
- SockAddr zero_clientaddr;
- memset(&zero_clientaddr, 0, sizeof(zero_clientaddr));
- if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr,
- sizeof(zero_clientaddr)) == 0)
+ if (pg_memory_is_all_zeros(&(beentry->st_clientaddr),
+ sizeof(beentry->st_clientaddr)))
It also means that you're removing these variables used only for the
all-zero comparisons. Makes sense to me.
--
Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou (Fujitsu) | 2024-12-11 06:09:15 | RE: Memory leak in pg_logical_slot_{get,peek}_changes |
| Previous Message | Michael Paquier | 2024-12-11 05:56:08 | Re: Fix comments related to pending statistics |