Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-05-10 12:38:10 +0400
committerVicent Martí <tanoku@gmail.com>2012-05-18 03:25:57 +0400
commit29e948debe603d7dd33a171a0101352e6b133a7a (patch)
tree6ceeea89bc6f6174536b0005b8e2c87735b82a8e /src/util.c
parent52695898e55f37cf657592dd9d7946c5a7938038 (diff)
global: Change parameter ordering in API
Consistency is good.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 9fd5f286c..ce770203a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -411,3 +411,27 @@ int git__strcmp_cb(const void *a, const void *b)
return strcmp(stra, strb);
}
+
+int git__parse_bool(int *out, const char *value)
+{
+ /* A missing value means true */
+ if (value == NULL) {
+ *out = 1;
+ return 0;
+ }
+
+ if (!strcasecmp(value, "true") ||
+ !strcasecmp(value, "yes") ||
+ !strcasecmp(value, "on")) {
+ *out = 1;
+ return 0;
+ }
+ if (!strcasecmp(value, "false") ||
+ !strcasecmp(value, "no") ||
+ !strcasecmp(value, "off")) {
+ *out = 0;
+ return 0;
+ }
+
+ return -1;
+}