On Wed, 30 Apr 2025 at 21:36, Daniel Gustafsson
<dgustafsson@postgresql.org> wrote:
> Add missing string terminator
A possible minor niggle. Would memcpy not be a more suitable function
for this? It's just there've been a few efforts in the past to try
and minimise the usage of strncpy(). There should really just be a
small handful of cases where the strange behaviour of that function is
needed. I don't think this is one of those cases.
Maybe something like the following would suit better?
#define REMAINING_TOTALS "Remaining Totals"
num_individual_stats = context_id + 1;
meminfo[max_stats - 1].name = dsa_allocate(MemoryStatsDsaArea,
sizeof(REMAINING_TOTALS));
nameptr = dsa_get_address(MemoryStatsDsaArea, meminfo[max_stats - 1].name);
memcpy(nameptr, REMAINING_TOTALS, sizeof(REMAINING_TOTALS));
David