array_large_size_remalloc_impl (gpointer mem,
gsize n_bytes)
{
- /* We only care that g_array_set_size() doesn't hang; we'll never
- * actually use any of the 2G of memory that it requests, so it's
- * OK that we don't actually allocate the whole thing.
+ /* We only care that g_array_set_size() doesn't hang before
+ * calling g_realloc(). So if we got here, we already won.
*/
- return realloc (mem, MIN (n_bytes, 1024 * 1024));
+ exit (0);
}
static GMemVTable array_large_size_mem_vtable = {
{
g_mem_set_vtable (&array_large_size_mem_vtable);
g_array_set_size (array, 1073750016);
- exit (0); /* success */
+ g_assert_not_reached ();
}
g_test_trap_assert_passed ();
int pipes[2];
int passed = 0;
int messages = 0;
+ const char * line_term;
+ int line_term_len;
if (0 > pipe (pipes))
{
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
g_assert (g_io_channel_get_line_term (channel, NULL) == NULL);
g_io_channel_set_line_term (channel, "\n", 1);
- g_assert_cmpstr (g_io_channel_get_line_term (channel, NULL), ==, "\n");
+ line_term = g_io_channel_get_line_term (channel, &line_term_len);
+ g_assert_cmpint (*line_term, ==, '\n');
+ g_assert_cmpint (line_term_len, ==, 1);
io_source = g_io_add_watch (channel, G_IO_IN, test_message_cb1, tlb);
child_source = g_child_watch_add (pid, test_message_cb2, loop);