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

[PATCH 00/10] mark private symbols static

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 14, 2015, 23:40 UTC
Message-ID
<1421278855-8126-1-git-send-email-gitster@pobox.com>

Here are a handful of patches to make symbols that are only used within a .c file as static. This is not the kind of changes we would want to do in the pre-release freeze period, and it is just for reference. I may later come back to them after 2.3 final is tagged.

Note that I did not blindly make everything that _could_ be made static; the ones I deliberately left untouched are:

 * config.c: this has a lot of git_configset_*() API functions that
   were developed but not yet used (as part of 3/4-way done GSoc
   project that did not fully convert users of the config subsystem
   to these new style functions); making them static merely because
   they are not yet used goes backwards.
 * ewah/* and xdiff/*: I consider these borrowed code, which we
   would want to avoid touching in the same series as our own code.
 * graph.c: graph_next_line() and graph_set_column_colors() are not
   called externally, but I suspect that they are API functions
   waiting for a new caller to appear.
 * line-log.c: range_set_append() is not called externally, but this
   is only because a caller calls range_set_append_unsafe(), its
   sibling, which may want to be cleaned up.
 * refs.c: rollback_packed_refs() is not called externally, but the
   codebase around refs API is in flux and I did not want to add to
   the code churn.
 * strbuf.c: xstrvfmt() is not called externally, but this is a
   reasonable API function to keep; its friend xstrfmt() is used by
   many places.
 * string-list.c: print_string_list() may want to go, but it may
   be useful for debugging, so I kept it in.
 * wrapper.c: rmdir_or_warn() is not used externally, but this is a
   reasonable API function as its friends like unlink_or_warn() that
   are used.

The last patch in the series is very questionable. Instead of hiding unused author_ident_sufficiently_given() function (and possibly removing it), it adds external callers to justify its existence ;-)

Junio C Hamano (10):
  http.c: make finish_active_slot() and handle_curl_result() static
  line-log.c: make line_log_data_init() static
  prompt.c: remove git_getpass() nobody uses
  revision.c: make save_parents() and free_saved_parents() static
  urlmatch.c: make match_urls() static
  remote.c: make clear_cas_option() static
  shallow.c: make check_shallow_file_for_update() static
  pack-bitmap.c: make pack_bitmap_filename() static
  read-cache.c: make fill/match_stat_data() static
  commit: show "Author:" hint when the ident is not given explicitly
 builtin/commit.c |   6 ++--
 cache.h          |  14 --------
 commit.h         |   1 -
 http.c           |  64 ++++++++++++++++-----------------
 http.h           |   2 --
 line-log.c       |   2 +-
 line-log.h       |   2 --
 pack-bitmap.c    |  28 +++++++--------
 pack-bitmap.h    |   1 -
 prompt.c         |   5 ---
 prompt.h         |   1 -
 read-cache.c     |  14 ++++++--
 remote.c         |   2 +-
 remote.h         |   1 -
 revision.c       | 106 +++++++++++++++++++++++++++++--------------------------
 revision.h       |  12 +++----
 shallow.c        |   2 +-
 urlmatch.c       |   6 ++--
 urlmatch.h       |   1 -
 19 files changed, 127 insertions(+), 143 deletions(-)
-- 
2.3.0-rc0-134-g109a908
Next: Junio C Hamano
Message 1 of 19 in “mark private symbols static”
  1. 00/10 mark private symbols staticJunio C Hamano, Jan 14, 2015
  2. 01/10 http.c: make finish_active_slot() and handle_curl_result() staticJunio C Hamano, Jan 14, 2015
  3. Jeff KingJan 15, 2015
  4. 02/10 line-log.c: make line_log_data_init() staticJunio C Hamano, Jan 14, 2015
  5. 03/10 prompt.c: remove git_getpass() nobody usesJunio C Hamano, Jan 14, 2015
  6. Jeff KingJan 15, 2015
  7. 04/10 revision.c: make save_parents() and free_saved_parents() staticJunio C Hamano, Jan 14, 2015
  8. 05/10 urlmatch.c: make match_urls() staticJunio C Hamano, Jan 14, 2015
  9. Jeff KingJan 15, 2015
  10. 06/10 remote.c: make clear_cas_option() staticJunio C Hamano, Jan 14, 2015
  11. 07/10 shallow.c: make check_shallow_file_for_update() staticJunio C Hamano, Jan 14, 2015
  12. 08/10 pack-bitmap.c: make pack_bitmap_filename() staticJunio C Hamano, Jan 14, 2015
  13. Jeff KingJan 15, 2015
  14. 09/10 read-cache.c: make fill/match_stat_data() staticJunio C Hamano, Jan 14, 2015
  15. 10/10 commit: show "Author:" hint when the ident is not given explicitlyJunio C Hamano, Jan 14, 2015
  16. Jeff KingJan 15, 2015
  17. Stefan BellerJan 15, 2015
  18. Jeff KingJan 15, 2015
  19. Junio C HamanoJan 15, 2015

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.