]> git.proxmox.com Git - libgit2.git/blame - script/user_nodefs.h
Merge pull request #3631 from ethomson/giterr_fixups
[libgit2.git] / script / user_nodefs.h
CommitLineData
8dddea42
PS
1/*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7
8#nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
5981ab1d
PS
9
10#nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \
11 if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); }
12
13#nodef GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
14 if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
15 GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { __coverity_panic__(); }
16
17#nodef GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
18 if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
19 GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
20 GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { __coverity_panic__(); }
21
22#nodef GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
23 if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { __coverity_panic__(); }
24
25#nodef GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) { __coverity_panic__(); }
40f6f225
PS
26
27#nodef LOOKS_LIKE_DRIVE_PREFIX(S) (strlen(S) >= 2 && git__isalpha((S)[0]) && (S)[1] == ':')