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

[PATCH 3/4] diff: change scope of the function count_lines()

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Jul 2, 2020, 19:24 UTC
Message-ID
<20200702192409.21865-4-shouryashukla.oo@gmail.com>
In-Reply-To
<20200702192409.21865-1-shouryashukla.oo@gmail.com>
From: Prathamesh Chavan <pc44800@gmail.com>

Change the scope of function count_lines for allowing the function to be reused in other parts of the code as well.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Stefan Beller <sbeller@google.com>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
---
 diff.c | 2 +-
 diff.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/diff.c b/diff.c
index 4a2c631c37..39ddbcf451 100644
--- a/diff.c
+++ b/diff.c
@@ -547,7 +547,7 @@ struct emit_callback {
 	struct strbuf *header;
 };
 
-static int count_lines(const char *data, int size)
+int count_lines(const char *data, int size)
 {
 	int count, ch, completely_empty = 1, nl_just_seen = 0;
 	count = 0;
diff --git a/diff.h b/diff.h
index 9443dc1b00..bd96c8c434 100644
--- a/diff.h
+++ b/diff.h
@@ -495,6 +495,7 @@ void free_diffstat_info(struct diffstat_t *diffstat);
 int parse_long_opt(const char *opt, const char **argv,
 		   const char **optarg);
 
+int count_lines(const char *data, int size);
 int git_diff_basic_config(const char *var, const char *value, void *cb);
 int git_diff_heuristic_config(const char *var, const char *value, void *cb);
 void init_diff_ui_defaults(void);
-- 
2.27.0
Previous: Shourya ShuklaNext: Johannes Schindelin
Message 9 of 21 in “submodule: port 'summary' from Shell to C”
  1. Shourya ShuklaJul 2, 2020
  2. 1/4 submodule: amend extra line feed between callback struct and macroShourya Shukla, Jul 2, 2020
  3. Johannes SchindelinJul 3, 2020
  4. Philip OakleyJul 3, 2020
  5. Shourya ShuklaJul 4, 2020
  6. Đoàn Trần Công DanhJul 4, 2020
  7. Philip OakleyJul 5, 2020
  8. 2/4 submodule: rename helper functions to avoid ambiguityShourya Shukla, Jul 2, 2020
  9. 3/4 diff: change scope of the function count_lines()Shourya Shukla, Jul 2, 2020
  10. Johannes SchindelinJul 3, 2020
  11. Shourya ShuklaJul 4, 2020
  12. Christian CouderJul 4, 2020
  13. 4/4 submodule: port submodule subcommand 'summary' from shell to CShourya Shukla, Jul 2, 2020
  14. Johannes SchindelinJul 3, 2020
  15. Shourya ShuklaJul 5, 2020
  16. Kaartic SivaraamJul 6, 2020
  17. Shourya ShuklaJul 6, 2020
  18. Johannes SchindelinJul 12, 2020
  19. Shourya ShuklaJul 15, 2020
  20. Shourya ShuklaJul 15, 2020
  21. Johannes SchindelinAug 10, 2020

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.