summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2007-11-09 21:13:46 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-11-09 21:13:46 -0800
commit0d9d89f61c58f72d96585a61defb0634873c38ac (patch)
treefcb314481bb669dcf1f33ba3934786c1dcc51b12 /git-compat-util.h
parentMerge branch 'jk/terse-push' into aw/mirror-push (diff)
parentUpdate draft release notes for 1.5.4 (diff)
downloadtgif-0d9d89f61c58f72d96585a61defb0634873c38ac.tar.xz
Merge master into aw/mirror-push
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 474f1d1ffb..7b29d1b905 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -381,4 +381,17 @@ static inline int strtoul_ui(char const *s, int base, unsigned int *result)
return 0;
}
+static inline int strtol_i(char const *s, int base, int *result)
+{
+ long ul;
+ char *p;
+
+ errno = 0;
+ ul = strtol(s, &p, base);
+ if (errno || *p || p == s || (int) ul != ul)
+ return -1;
+ *result = ul;
+ return 0;
+}
+
#endif