[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] lib/rename.c: rpl_rename - Avoid unused-but-set-variable com
From: |
Ben Walton |
Subject: |
Re: [PATCH] lib/rename.c: rpl_rename - Avoid unused-but-set-variable compiler warning |
Date: |
Mon, 2 Jun 2014 20:45:52 +0100 |
The value is set in se
On Mon, Jun 2, 2014 at 8:31 PM, Pádraig Brady <address@hidden> wrote:
> On 06/02/2014 08:13 PM, Ben Walton wrote:
>> * In the non-Win32 variant of rpl_rename, it is possible that
>> dst_exists may be set but not used. Mark it with the unused
>> attribute to avoid compiler warnings.
>>
>> Signed-off-by: Ben Walton <address@hidden>
>> ---
>> lib/rename.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/rename.c b/lib/rename.c
>> index 55130d8..099066d 100644
>> --- a/lib/rename.c
>> +++ b/lib/rename.c
>> @@ -285,7 +285,7 @@ rpl_rename (char const *src, char const *dst)
>> char *dst_temp = (char *) dst;
>> bool src_slash;
>> bool dst_slash;
>> - bool dst_exists;
>> + bool dst_exists _GL_UNUSED;
>> int ret_val = -1;
>> int rename_errno = ENOTDIR;
>> struct stat src_st;
>>
>
> Have to say that I don't see this from looking at the code,
> since it seems to just return or set dst_exists?
The value is only referenced if RENAME_DEST_EXISTS_BUG is set.
Otherwise, it's set but never used again. This patch addresses the
case where RENAME_DEST_EXISTS_BUG is unset.
Thanks
-Ben
--
---------------------------------------------------------------------------------------------------------------------------
Take the risk of thinking for yourself. Much more happiness,
truth, beauty and wisdom will come to you that way.
-Christopher Hitchens
---------------------------------------------------------------------------------------------------------------------------