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

[PATCH] range-diff: fix some 'hdr-check' and sparse warnings

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Jul 11, 2019, 22:03 UTC
Message-ID
<e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Thomas,

If you need to re-roll your 'tg/range-diff-output-update' branch, could you please squash (parts) of this into the relevant patches.

The first hunk fixes a couple of 'hdr-check' warnings:
  $ diff nhcout phcout | head
  4a5,13
  > apply.h:146:22: error: ‘GIT_MAX_HEXSZ’ undeclared here (not in a function); did you mean ‘NI_MAXHOST’?
  >   char old_oid_prefix[GIT_MAX_HEXSZ + 1];
  >                       ^~~~~~~~~~~~~
  >                       NI_MAXHOST
  > apply.h:151:19: error: array type has incomplete element type ‘struct object_id’
  >   struct object_id threeway_stage[3];
  >                    ^~~~~~~~~~~~~~
  > Makefile:2775: recipe for target 'apply.hco' failed
  > make: *** [apply.hco] Error 1
  $ 

and needs to be applied to commit b9f62a7e24 ("apply: make parse_git_header public", 2019-07-08).

The second hunk fixes a sparse 'Using plain integer as NULL pointer' warning, and needs to be applied to commit 04539fc67b ("range-diff: add section header instead of diff header", 2019-07-08).

Thanks!

ATB, Ramsay Jones

 apply.h      | 1 +
 range-diff.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/apply.h b/apply.h
index ade50f66c5..c8c9287cb2 100644
--- a/apply.h
+++ b/apply.h
@@ -3,6 +3,7 @@
 
 #include "lockfile.h"
 #include "string-list.h"
+#include "hash.h"
 
 struct repository;
 
diff --git a/range-diff.c b/range-diff.c
index ba1e9a4265..0f24a4ad12 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -102,7 +102,7 @@ static int read_patches(const char *range, struct string_list *list)
 		}
 
 		if (starts_with(line, "diff --git")) {
-			struct patch patch = { 0 };
+			struct patch patch = { NULL };
 			struct strbuf root = STRBUF_INIT;
 			int linenr = 0;
 
-- 
2.22.0
Next: Johannes Sixt
Message 1 of 23 in “range-diff: fix some 'hdr-check' and sparse warnings”
  1. range-diff: fix some 'hdr-check' and sparse warningsRamsay Jones, Jul 11, 2019
  2. Johannes SixtJul 12, 2019
  3. Junio C HamanoJul 12, 2019
  4. Johannes SixtJul 13, 2019
  5. Johannes SixtJul 13, 2019
  6. Carlo ArenasJul 13, 2019
  7. Junio C HamanoJul 13, 2019
  8. Carlo ArenasJul 13, 2019
  9. Jeff KingJul 14, 2019
  10. Johannes SixtJul 14, 2019
  11. Jeff KingJul 15, 2019
  12. Johannes SixtJul 15, 2019
  13. Jeff KingJul 15, 2019
  14. Junio C HamanoJul 16, 2019
  15. Jeff KingJul 16, 2019
  16. Junio C HamanoJul 17, 2019
  17. Jeff KingJul 17, 2019
  18. Junio C HamanoJul 17, 2019
  19. Johannes SixtJul 17, 2019
  20. Johannes SchindelinJul 15, 2019
  21. Junio C HamanoOct 2, 2020
  22. Johannes SchindelinOct 4, 2020
  23. Johannes SixtJul 14, 2019

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.