pager: make pager_program a file-local static
authorJeff King <peff@peff.net>
Tue, 13 Sep 2016 03:23:48 +0000 (20:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Sep 2016 22:45:45 +0000 (15:45 -0700)
This variable is only ever used by the routines in pager.c,
and other parts of the code should always use those routines
(like git_pager()) to make decisions about which pager to
use. Let's reduce its scope to prevent accidents.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
environment.c
pager.c
diff --git a/cache.h b/cache.h
index 4ff196c25926cb1a6662f7582969ed665bae5ee3..5e50887d63d2cd3883eab8cdea12ad5ee8e19c4d 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1733,7 +1733,6 @@ extern int write_file_gently(const char *path, const char *fmt, ...);
 
 /* pager.c */
 extern void setup_pager(void);
-extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 extern int term_columns(void);
index 96160a75a53340fcc9b2e1a81d2198d073bd4562..bccdee9d0b2942763807e69311a730cc8e23d66c 100644 (file)
@@ -39,7 +39,6 @@ size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
 size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
 size_t delta_base_cache_limit = 96 * 1024 * 1024;
 unsigned long big_file_threshold = 512 * 1024 * 1024;
-const char *pager_program;
 int pager_use_color = 1;
 const char *editor_program;
 const char *askpass_program;
diff --git a/pager.c b/pager.c
index fc210f951d50add067dcb8f13d231e3b72148c25..00c8baace0f9bf73c8f809639babce775310237b 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -7,6 +7,7 @@
 #endif
 
 static struct child_process pager_process = CHILD_PROCESS_INIT;
+static const char *pager_program;
 
 static void wait_for_pager(int in_signal)
 {