Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
contrib/hooks/post-receive-email: fix typo
[gitweb.git]
/
git-compat-util.h
diff --git
a/git-compat-util.h
b/git-compat-util.h
index 474f1d1ffbee5433ec311174ee37804ab16417bb..7b29d1b905c618a50704a7b2c38041f71c942e71 100644
(file)
--- 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