From 0c9eacf3d2c83256736a5bb2a240e73afd13d55f Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 2 Aug 2012 01:15:24 +0200 Subject: attr: Do not export variables externally Fixes #824 Exporting variables in a dynamic library is a PITA. Let's keep these values internally and wrap them through a helper method. This doesn't break the external API. @arrbee, aren't you glad I turned the `GIT_ATTR_` macros into function macros? :sparkles: --- src/attr_file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/attr_file.c') diff --git a/src/attr_file.c b/src/attr_file.c index 837c42d8e..966da4069 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -5,10 +5,6 @@ #include "git2/tree.h" #include -const char *git_l_attr__true = "[internal]__TRUE__"; -const char *git_l_attr__false = "[internal]__FALSE__"; -const char *git_l_attr__unset = "[internal]__UNSET__"; - static int sort_by_hash_and_name(const void *a_raw, const void *b_raw); static void git_attr_rule__clear(git_attr_rule *rule); @@ -493,14 +489,14 @@ int git_attr_assignment__parse( } assign->name_hash = 5381; - assign->value = git_l_attr__true; + assign->value = git_attr__true; /* look for magic name prefixes */ if (*scan == '-') { - assign->value = git_l_attr__false; + assign->value = git_attr__false; scan++; } else if (*scan == '!') { - assign->value = git_l_attr__unset; /* explicit unspecified state */ + assign->value = git_attr__unset; /* explicit unspecified state */ scan++; } else if (*scan == '#') /* comment rest of line */ break; @@ -536,7 +532,7 @@ int git_attr_assignment__parse( } /* expand macros (if given a repo with a macro cache) */ - if (repo != NULL && assign->value == git_l_attr__true) { + if (repo != NULL && assign->value == git_attr__true) { git_attr_rule *macro = git_attr_cache__lookup_macro(repo, assign->name); -- cgit v1.2.3