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

[PATCH 04/10] diff.c/diff.h: expose userdiff_funcname

From
DLDavid A. Dalrymple (and Bhushan G. Lodha) <dad-bgl@mit.edu>
Date
Mar 27, 2014, 18:50 UTC
Message-ID
<72e13d200ede2908cb5d9780a6a2b478b568c2fb.1395942768.git.davidad@alum.mit.edu>
In-Reply-To
<1395946256-67124-1-git-send-email-dad-bgl@mit.edu>
From: "Bhushan G. Lodha & David A. Dalrymple" <dad-bgl@mit.edu>

The functionality of userdiff_funcname (determining the language in use for a given file and setting up patterns to match "function names" in that language) is useful outside of diff.c, so here we remove its static specifier and declare it in diff.h.

Signed-off-by: David Dalrymple (on zayin) <davidad@alum.mit.edu>
---
 diff.c | 2 +-
 diff.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/diff.c b/diff.c
index e343191..f978ee7 100644
--- a/diff.c
+++ b/diff.c
@@ -2203,7 +2203,7 @@ int diff_filespec_is_binary(struct diff_filespec *one)
 	return one->is_binary;
 }
 
-static const struct userdiff_funcname *diff_funcname_pattern(struct diff_filespec *one)
+const struct userdiff_funcname *diff_funcname_pattern(struct diff_filespec *one)
 {
 	diff_filespec_load_driver(one);
 	return one->driver->funcname.pattern ? &one->driver->funcname : NULL;
diff --git a/diff.h b/diff.h
index a24a767..9e96fc9 100644
--- a/diff.h
+++ b/diff.h
@@ -349,4 +349,6 @@ extern int print_stat_summary(FILE *fp, int files,
 			      int insertions, int deletions);
 extern void setup_diff_pager(struct diff_options *);
 
+const struct userdiff_funcname *diff_funcname_pattern(struct diff_filespec *);
+
 #endif /* DIFF_H */
-- 
1.7.12.4 (Apple Git-37)
Previous: Jakub NarębskiNext: David A. Dalrymple (and Bhushan G. Lodha)
Message 6 of 23 in “[RFC] pickaxe for function names”
  1. 00/10 [RFC] pickaxe for function namesDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  2. 01/10 .gitattributes: specify the language usedDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  3. 02/10 diffcore-pickaxe.c: refactor regex compilationDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  4. 03/10 diffcore-pickaxe.c: Refactor pickaxe_fn signatureDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  5. Jakub NarębskiApr 4, 2014
  6. 04/10 diff.c/diff.h: expose userdiff_funcnameDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  7. 05/10 diffcore-pickaxe.c: set up funcname patternDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  8. 06/10 log: --function-name pickaxeDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  9. René ScharfeApr 3, 2014
  10. Junio C HamanoApr 3, 2014
  11. Jakub NarębskiApr 4, 2014
  12. Junio C HamanoApr 4, 2014
  13. Bhushan LodhaApr 28, 2014
  14. 07/10 xdiff: add XDL_EMIT_MOREFUNCNAMESDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  15. 08/10 xdiff: add XDL_EMIT_MOREHUNKHEADSDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  16. 09/10 t4213: test --function-name optionDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  17. Johannes SixtMar 28, 2014
  18. Eric SunshineMar 28, 2014
  19. Johannes SixtMar 28, 2014
  20. Jakub NarębskiApr 4, 2014
  21. 10/10 Documentation: Document --function-name usageDavid A. Dalrymple (and Bhushan G. Lodha), Mar 27, 2014
  22. Eric SunshineMar 28, 2014
  23. Jeff KingMar 27, 2014

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.