Blame script/user_nodefs.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); }
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC_BUF(buf) if (buf == NULL || git_buf_oom(buf)) { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \
Packit ae9e2a
	if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
Packit ae9e2a
	if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
Packit ae9e2a
		GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
Packit ae9e2a
	if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
Packit ae9e2a
		GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
Packit ae9e2a
		GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
Packit ae9e2a
	if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0)  { __coverity_panic__(); }
Packit ae9e2a
Packit ae9e2a
#nodef LOOKS_LIKE_DRIVE_PREFIX(S) (strlen(S) >= 2 && git__isalpha((S)[0]) && (S)[1] == ':')
Packit ae9e2a
Packit ae9e2a
#nodef git_vector_foreach(v, iter, elem)	\
Packit ae9e2a
	for ((iter) = 0; (v)->contents != NULL && (iter) < (v)->length && ((elem) = (v)->contents[(iter)], 1); (iter)++ )
Packit ae9e2a
Packit ae9e2a
#nodef git_vector_rforeach(v, iter, elem)	\
Packit ae9e2a
	for ((iter) = (v)->length - 1; (v)->contents != NULL && (iter) < SIZE_MAX && ((elem) = (v)->contents[(iter)], 1); (iter)-- )