<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/tests/core/assert.c, branch ethomson/diff_enum</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>assert: allow non-int returning functions to assert</title>
<updated>2020-05-11T19:13:54+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2020-04-01T21:12:07+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libgit2.git/commit/?id=cbae1c219d97dbc3cb0b88abe3bf6c21d019ebf8'/>
<id>cbae1c219d97dbc3cb0b88abe3bf6c21d019ebf8</id>
<content type='text'>
Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that
functions that do not return int (or more precisely, where `-1` would
not be an error code) can assert.

This allows functions that return, eg, NULL on an error code to do that
by passing the return value (in this example, `NULL`) as a second
parameter to the GIT_ASSERT_WITH_RETVAL functions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that
functions that do not return int (or more precisely, where `-1` would
not be an error code) can assert.

This allows functions that return, eg, NULL on an error code to do that
by passing the return value (in this example, `NULL`) as a second
parameter to the GIT_ASSERT_WITH_RETVAL functions.
</pre>
</div>
</content>
</entry>
<entry>
<title>assert: optionally fall-back to assert(3)</title>
<updated>2020-05-11T19:13:54+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2020-01-12T10:31:07+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libgit2.git/commit/?id=a95096ba5f72db71422ffd9ea6630160387b97c0'/>
<id>a95096ba5f72db71422ffd9ea6630160387b97c0</id>
<content type='text'>
Fall back to the system assert(3) in debug builds, which may aide
in debugging.

"Safe" assertions can be enabled in debug builds by setting
GIT_ASSERT_HARD=0.  Similarly, hard assertions can be enabled in
release builds by setting GIT_ASSERT_HARD to nonzero.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fall back to the system assert(3) in debug builds, which may aide
in debugging.

"Safe" assertions can be enabled in debug builds by setting
GIT_ASSERT_HARD=0.  Similarly, hard assertions can be enabled in
release builds by setting GIT_ASSERT_HARD to nonzero.
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce GIT_ASSERT macros</title>
<updated>2020-05-11T19:13:54+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2019-12-09T02:37:34+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libgit2.git/commit/?id=abe2efe1ff84d423ef5f104b1e95e9ef66442c0f'/>
<id>abe2efe1ff84d423ef5f104b1e95e9ef66442c0f</id>
<content type='text'>
Provide macros to replace usages of `assert`.  A true `assert` is
punishing as a library.  Instead we should do our best to not crash.

GIT_ASSERT_ARG(x) will now assert that the given argument complies to
some format and sets an error message and returns `-1` if it does not.

GIT_ASSERT(x) is for internal usage, and available as an internal
consistency check.  It will set an error message and return `-1` in the
event of failure.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Provide macros to replace usages of `assert`.  A true `assert` is
punishing as a library.  Instead we should do our best to not crash.

GIT_ASSERT_ARG(x) will now assert that the given argument complies to
some format and sets an error message and returns `-1` if it does not.

GIT_ASSERT(x) is for internal usage, and available as an internal
consistency check.  It will set an error message and return `-1` in the
event of failure.
</pre>
</div>
</content>
</entry>
</feed>
