[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tar-1.33/src/buffer.c:1733:redundantAssignment
From: |
David Binderman |
Subject: |
Re: tar-1.33/src/buffer.c:1733:redundantAssignment |
Date: |
Fri, 8 Jan 2021 16:39:19 +0000 |
Hello there,
>> tar-1.33/src/buffer.c:1733:25: style: Variable 'st.orig_file_name' is
>> reassigned a value before the old one >has been used. [redundantAssignment]
>As a matter of fact, its value *is* used before reasignment. By
>xheader_format_name.
Agreed. The static analyser tool cppcheck has merely noticed that
st.orig_file_name
is not written to between lines 1729 and 1733.
I notice that the only field of struct st that function xheader_format_name
uses is orig_file_name. Would it be better to replace the struct st parameter
of the function with a const char * parameter ?
Something like
char *
xheader_format_name (const char * orig_file_name, const char *fmt, size_t n)
{
Regards
David Binderman