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

[PATCH v1 3/6] apply: move `apply_default_*whitespace` to `apply.c`

From
Ben Boeckel <mathstuf@gmail.com>
Date
Jul 31, 2021, 02:42 UTC
Message-ID
<20210731024221.2113906-4-mathstuf@gmail.com>
In-Reply-To
<20210731024221.2113906-1-mathstuf@gmail.com>

These variables are only set and used in this file, so they can become `static`.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 apply.c       | 3 +++
 cache.h       | 2 --
 environment.c | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/apply.c b/apply.c
index 44bc31d6eb..15dcd8b7d7 100644
--- a/apply.c
+++ b/apply.c
@@ -23,6 +23,9 @@
 #include "apply.h"
 #include "entry.h"
 
+static char *apply_default_whitespace;
+static char *apply_default_ignorewhitespace;
+
 struct gitdiff_data {
 	struct strbuf *root;
 	int linenr;
diff --git a/cache.h b/cache.h
index 551a6cb5cf..dc6c4172cb 100644
--- a/cache.h
+++ b/cache.h
@@ -944,8 +944,6 @@ extern int assume_unchanged;
 extern int prefer_symlink_refs;
 extern int warn_ambiguous_refs;
 extern int warn_on_object_refname_ambiguity;
-extern char *apply_default_whitespace;
-extern char *apply_default_ignorewhitespace;
 extern const char *git_attributes_file;
 extern const char *git_hooks_path;
 extern int zlib_compression_level;
diff --git a/environment.c b/environment.c
index 5d45152731..0cc086d847 100644
--- a/environment.c
+++ b/environment.c
@@ -36,8 +36,6 @@ int repository_format_precious_objects;
 int repository_format_worktree_config;
 const char *git_commit_encoding;
 const char *git_log_output_encoding;
-char *apply_default_whitespace;
-char *apply_default_ignorewhitespace;
 const char *git_attributes_file;
 const char *git_hooks_path;
 int zlib_compression_level = Z_BEST_SPEED;
-- 
2.31.1
Previous: Ben BoeckelNext: Ben Boeckel
Message 3 of 7 in “globals: clean up some global usages”
  1. 0/6 globals: clean up some global usagesBen Boeckel, Jul 31, 2021
  2. 1/6 branch: move `git_default_branch_config` to `branch.c`Ben Boeckel, Jul 31, 2021
  3. 3/6 apply: move `apply_default_*whitespace` to `apply.c`Ben Boeckel, Jul 31, 2021
  4. 2/6 mailmap: move `git_default_mailmap_config` to `mailmap.c`Ben Boeckel, Jul 31, 2021
  5. 4/6 config: remove `core_compression_level`Ben Boeckel, Jul 31, 2021
  6. 5/6 refs/debug: declare file-local variable to be staticBen Boeckel, Jul 31, 2021
  7. 6/6 globals: remove explicit `0` initialization from globalsBen Boeckel, Jul 31, 2021

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.