diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-02-11 14:52:08 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-02-12 22:54:47 -0500 |
commit | 190b76a69875da49973d1a5d8fd3b96c0cd43425 (patch) | |
tree | 4d222031bd0f538d5119698d1e184a71daf78f98 /src/util.h | |
parent | 8d534b475829edf87c8126fc4ae30f593172f317 (diff) | |
download | libgit2-190b76a69875da49973d1a5d8fd3b96c0cd43425.tar.gz |
Introduce git__add_sizet_overflow and friends
Add some helper functions to check for overflow in a type-specific
manner.
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/util.h b/src/util.h index dcdaf4363..86139ef77 100644 --- a/src/util.h +++ b/src/util.h @@ -146,34 +146,6 @@ extern int git__strtol64(int64_t *n, const char *buff, const char **end_buf, int extern void git__hexdump(const char *buffer, size_t n); extern uint32_t git__hash(const void *key, int len, uint32_t seed); -/** @return true if p fits into the range of a size_t */ -GIT_INLINE(int) git__is_sizet(git_off_t p) -{ - size_t r = (size_t)p; - return p == (git_off_t)r; -} - -/** @return true if p fits into the range of an ssize_t */ -GIT_INLINE(int) git__is_ssizet(size_t p) -{ - ssize_t r = (ssize_t)p; - return p == (size_t)r; -} - -/** @return true if p fits into the range of a uint32_t */ -GIT_INLINE(int) git__is_uint32(size_t p) -{ - uint32_t r = (uint32_t)p; - return p == (size_t)r; -} - -/** @return true if p fits into the range of an unsigned long */ -GIT_INLINE(int) git__is_ulong(git_off_t p) -{ - unsigned long r = (unsigned long)p; - return p == (git_off_t)r; -} - /* 32-bit cross-platform rotl */ #ifdef _MSC_VER /* use built-in method in MSVC */ # define git__rotl(v, s) (uint32_t)_rotl(v, s) |