Remove useless code in InjectionPointAttach()
authorMichael Paquier <[email protected]>
Tue, 16 Dec 2025 23:58:58 +0000 (08:58 +0900)
committerMichael Paquier <[email protected]>
Tue, 16 Dec 2025 23:58:58 +0000 (08:58 +0900)
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 0eb23285a257.

Author: Feilong Meng <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Discussion: https://postgr.es/m/[email protected]

src/backend/utils/misc/injection_point.c

index 54a9fe8e16325cdb6c92c2a345e1372a8f1837ee..4945da458b18a6b3fb468fa67d41f102cbb0d222 100644 (file)
@@ -331,11 +331,8 @@ InjectionPointAttach(const char *name,
 
    /* Save the entry */
    strlcpy(entry->name, name, sizeof(entry->name));
-   entry->name[INJ_NAME_MAXLEN - 1] = '\0';
    strlcpy(entry->library, library, sizeof(entry->library));
-   entry->library[INJ_LIB_MAXLEN - 1] = '\0';
    strlcpy(entry->function, function, sizeof(entry->function));
-   entry->function[INJ_FUNC_MAXLEN - 1] = '\0';
    if (private_data != NULL)
        memcpy(entry->private_data, private_data, private_data_size);