diff options
author | Vicent Marti <tanoku@gmail.com> | 2012-08-02 03:15:24 +0400 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2012-08-02 03:15:24 +0400 |
commit | 0c9eacf3d2c83256736a5bb2a240e73afd13d55f (patch) | |
tree | 8e8518ab95a63bba4fb8388c9b05496e614f537e /src/attr.c | |
parent | cf81ded61caa66267be5f27539decae2292ace9a (diff) |
attr: Do not export variables externallyattr-export
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:
Diffstat (limited to 'src/attr.c')
-rw-r--r-- | src/attr.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/attr.c b/src/attr.c index 6fbd005d5..1c511993b 100644 --- a/src/attr.c +++ b/src/attr.c @@ -5,6 +5,25 @@ GIT__USE_STRMAP; +const char *git_attr__true = "[internal]__TRUE__"; +const char *git_attr__false = "[internal]__FALSE__"; +const char *git_attr__unset = "[internal]__UNSET__"; + +git_attr_t git_attr_value(const char *attr) +{ + if (attr == NULL || attr == git_attr__unset) + return GIT_ATTR_UNSPECIFIED_T; + + if (attr == git_attr__true) + return GIT_ATTR_TRUE_T; + + if (attr == git_attr__false) + return GIT_ATTR_FALSE_T; + + return GIT_ATTR_VALUE_T; +} + + static int collect_attr_files( git_repository *repo, uint32_t flags, |