git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] avoid set-but-not-used warning

From
Jim Meyering <jim@meyering.net>
Date
Apr 29, 2011, 09:42 UTC
Message-ID
<874o5hv1f2.fsf@rho.meyering.net>
I noticed this on master (also applies to next), compiling with gcc-4.6:
    diffcore-rename.c: In function 'diffcore_rename':
    diffcore-rename.c:501:18: warning: variable 'num_src' set but not used \
      [-Wunused-but-set-variable]
Here's the fix:
-- >8 --
Subject: [PATCH] avoid set-but-not-used warning
* diffcore-rename.c (diffcore_rename): Remove declaration and set.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 diffcore-rename.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/diffcore-rename.c b/diffcore-rename.c
index f62587e..3d65bb3 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -498,7 +498,7 @@ void diffcore_rename(struct diff_options *options)
 	struct diff_queue_struct outq;
 	struct diff_score *mx;
 	int i, j, rename_count, skip_unmodified = 0;
-	int num_create, num_src, dst_cnt;
+	int num_create, dst_cnt;
 	struct progress *progress = NULL;

 	if (!minimum_score)
@@ -554,7 +554,6 @@ void diffcore_rename(struct diff_options *options)
 	 * files still remain as options for rename/copies!)
 	 */
 	num_create = (rename_dst_nr - rename_count);
-	num_src = rename_src_nr;

 	/* All done? */
 	if (!num_create)
--
1.7.5.452.gcf2d0
Next: Junio C Hamano
Message 1 of 4 in “avoid set-but-not-used warning”
  1. avoid set-but-not-used warningJim Meyering, Apr 29, 2011
  2. Junio C HamanoApr 29, 2011
  3. Thiago FarinaApr 29, 2011
  4. Junio C HamanoApr 29, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.