Skip to content

Commit 1d325ad

Browse files
committed
Remove useless code in InjectionPointAttach()
strlcpy() ensures that a target string is zero-terminated, so there is no need to enforce it a second time in this code. This simplification could have been done in 0eb2328. Author: Feilong Meng <feelingmeng@foxmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/tencent_771178777C5BC17FCB7F7A1771CD1FFD5708@qq.com
1 parent 0a90df5 commit 1d325ad

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

src/backend/utils/misc/injection_point.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,8 @@ InjectionPointAttach(const char *name,
331331

332332
/* Save the entry */
333333
strlcpy(entry->name, name, sizeof(entry->name));
334-
entry->name[INJ_NAME_MAXLEN - 1] = '\0';
335334
strlcpy(entry->library, library, sizeof(entry->library));
336-
entry->library[INJ_LIB_MAXLEN - 1] = '\0';
337335
strlcpy(entry->function, function, sizeof(entry->function));
338-
entry->function[INJ_FUNC_MAXLEN - 1] = '\0';
339336
if (private_data != NULL)
340337
memcpy(entry->private_data, private_data, private_data_size);
341338

0 commit comments

Comments
 (0)