summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-08-10 19:23:00 +0200
committerPatrick Steinhardt <ps@pks.im>2018-09-21 12:11:06 +0200
commitb9affa329a18d076094442d5af30e294c8fe8722 (patch)
treed33759cabae098e00fc4525a8d81bd4435c5dd5d
parent0b9c68b1366e7ef458b4932f066c487498e6c79f (diff)
downloadlibgit2-b9affa329a18d076094442d5af30e294c8fe8722.tar.gz
config_parse: avoid unused static declared values
The variables `git_config_escaped` and `git_config_escapes` are both defined as static const character pointers in "config_parse.h". In case where "config_parse.h" is included but those two variables are not being used, the compiler will thus complain about defined but unused variables. Fix this by declaring them as external and moving the actual initialization to the C file. Note that it is not possible to simply make this a #define, as we are indexing into those arrays.
-rw-r--r--src/config_parse.c3
-rw-r--r--src/config_parse.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/config_parse.c b/src/config_parse.c
index 282aabe17..6e85bbe0d 100644
--- a/src/config_parse.c
+++ b/src/config_parse.c
@@ -11,6 +11,9 @@
#include <ctype.h>
+const char *git_config_escapes = "ntb\"\\";
+const char *git_config_escaped = "\n\t\b\"\\";
+
static void set_parse_error(git_config_parser *reader, int col, const char *error_str)
{
giterr_set(GITERR_CONFIG, "failed to parse config file: %s (in %s:%"PRIuZ", column %d)",
diff --git a/src/config_parse.h b/src/config_parse.h
index 6650b87f3..81a13fceb 100644
--- a/src/config_parse.h
+++ b/src/config_parse.h
@@ -12,8 +12,8 @@
#include "oid.h"
#include "parse.h"
-static const char *git_config_escapes = "ntb\"\\";
-static const char *git_config_escaped = "\n\t\b\"\\";
+extern const char *git_config_escapes;
+extern const char *git_config_escaped;
typedef struct config_file {
git_oid checksum;