[PATCH]Remove the redundant assignment

Feilong Meng <feelingmeng@foxmail.com>

From: "Feilong Meng" <feelingmeng@foxmail.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-16T06:18:05Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove useless code in InjectionPointAttach()

Attachments

Hi,Hackers,

I found that in the InjectionPointAttach function within the src/backend/utils/misc/injection_point.c file, the variable is manually assigned a '\0' at the end, even though strlcpy already guarantees that the destination buffer will be null-terminated and will not overflow.

The code modification is as follows:

```
/* Save the entry */
strlcpy(entry->name, name, sizeof(entry->name));
entry->name[INJ_NAME_MAXLEN - 1] = '\0';  <== Delete this line
strlcpy(entry->library, library, sizeof(entry->library));
entry->library[INJ_LIB_MAXLEN - 1] = '\0';  <== Delete this line
strlcpy(entry->function, function, sizeof(entry->function));
entry->function[INJ_FUNC_MAXLEN - 1] = '\0';  <== Delete this line
```

And in the injection_point_cache_add function within the same file, strlcpy(entry->name, name, sizeof(entry->name)); does not perform redundant assignment.

I have tested the change, and "make check" passed.



--------------

Best regards,


Feilong Meng