diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2015-09-03 13:42:36 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2015-09-03 13:42:36 +0200 |
commit | dfef7066a09748d9fa53b4de3e8dccbd2c324ed3 (patch) | |
tree | d602ddace8661173360b6f4e3e8f938b7de377ce /gir/glib-2.0.c | |
parent | d1f62064ff2a570d8648c622e5b59f3a561f7e9a (diff) | |
download | gobject-introspection-dfef7066a09748d9fa53b4de3e8dccbd2c324ed3.tar.gz |
Update glib annotations from git master
Diffstat (limited to 'gir/glib-2.0.c')
-rw-r--r-- | gir/glib-2.0.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c index c5a947ee..420ef239 100644 --- a/gir/glib-2.0.c +++ b/gir/glib-2.0.c @@ -6971,7 +6971,7 @@ * The first, and preferred, option is to store the source ID returned by * functions such as g_timeout_add() or g_source_attach(), and explicitly * remove that source from the main context using g_source_remove() when the - * owning object is finalised. This ensures that the callback can only be + * owning object is finalized. This ensures that the callback can only be * invoked while the object is still alive. * * The second option is to hold a strong reference to the object in the @@ -7677,11 +7677,11 @@ * "assertions", which consists of running the test_assertions function. * * In addition to the traditional g_assert(), the test framework provides - * an extended set of assertions for string and numerical comparisons: - * g_assert_cmpfloat(), g_assert_cmpint(), g_assert_cmpuint(), - * g_assert_cmphex(), g_assert_cmpstr(). The advantage of these variants - * over plain g_assert() is that the assertion messages can be more - * elaborate, and include the values of the compared entities. + * an extended set of assertions for comparisons: g_assert_cmpfloat(), + * g_assert_cmpint(), g_assert_cmpuint(), g_assert_cmphex(), + * g_assert_cmpstr(), and g_assert_cmpmem(). The advantage of these + * variants over plain g_assert() is that the assertion messages can be + * more elaborate, and include the values of the compared entities. * * GLib ships with two utilities called [gtester][gtester] and * [gtester-report][gtester-report] to facilitate running tests and producing @@ -9042,6 +9042,30 @@ /** + * g_assert_cmpmem: + * @m1: pointer to a buffer + * @l1: length of @m1 + * @m2: pointer to another buffer + * @l2: length of @m2 + * + * Debugging macro to compare memory regions. If the comparison fails, + * an error message is logged and the application is either terminated + * or the testcase marked as failed. + * + * The effect of `g_assert_cmpmem (m1, l1, m2, l2)` is + * the same as `g_assert_true (l1 == l2 && memcmp (m1, m2, l1) == 0)`. + * The advantage of this macro is that it can produce a message that + * includes the actual values of @l1 and @l2. + * + * |[<!-- language="C" --> + * g_assert_cmpmem (buf->data, buf->len, expected, sizeof (expected)); + * ]| + * + * Since: 2.46 + */ + + +/** * g_assert_cmpstr: * @s1: a string (may be %NULL) * @cmp: The comparison operator to use. @@ -10273,7 +10297,8 @@ * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63, * usually). To start searching from the 0th bit, set @nth_bit to -1. * - * Returns: the index of the first bit set which is higher than @nth_bit + * Returns: the index of the first bit set which is higher than @nth_bit, or -1 + * if no higher bits are set */ @@ -10288,7 +10313,8 @@ * usually). To start searching from the last bit, set @nth_bit to * -1 or GLIB_SIZEOF_LONG * 8. * - * Returns: the index of the first bit set which is lower than @nth_bit + * Returns: the index of the first bit set which is lower than @nth_bit, or -1 + * if no lower bits are set */ @@ -27732,8 +27758,10 @@ * strerror(), because it returns a string in UTF-8 encoding, and since * not all platforms support the strerror() function. * + * Note that the string may be translated according to the current locale. + * * Returns: a UTF-8 string describing the error code. If the error code - * is unknown, it returns "unknown error (<code>)". + * is unknown, it returns a string like "unknown error (<code>)". */ @@ -28048,7 +28076,7 @@ /** * g_string_free: - * @string: a #GString + * @string: (transfer full): a #GString * @free_segment: if %TRUE, the actual character data is freed as well * * Frees the memory allocated for the #GString. |