Merge branch 'wip/smcv/none-flags' into 'main'

Add a NONE or DEFAULT member to most flags-sets

See merge request GNOME/glib!2576
This commit is contained in:
Philip Withnall 2022-06-23 16:09:38 +00:00
commit 191923ce61
64 changed files with 384 additions and 256 deletions

View File

@ -589,7 +589,7 @@ g_cancellable_connect (GCancellable *cancellable,
id = g_signal_connect_data (cancellable, "cancelled",
callback, data,
(GClosureNotify) data_destroy_func,
0);
G_CONNECT_DEFAULT);
g_mutex_unlock (&cancellable_mutex);
}

View File

@ -435,7 +435,8 @@ load_comment_for_mime_helper (const char *dir,
if (!res)
return NULL;
context = g_markup_parse_context_new (&parser, 0, &parse_data, NULL);
context = g_markup_parse_context_new (&parser, G_MARKUP_PARSE_FLAGS_NONE,
&parse_data, NULL);
res = g_markup_parse_context_parse (context, data, len, NULL);
g_free (data);
g_markup_parse_context_free (context);

View File

@ -1456,7 +1456,7 @@ initable_init (GInitable *initable,
G_CALLBACK (on_notify_g_name_owner),
weak_ref_new (G_OBJECT (manager)),
(GClosureNotify) weak_ref_free,
0 /* flags */);
G_CONNECT_DEFAULT);
manager->priv->signal_signal_id =
g_signal_connect_data (manager->priv->control_proxy,
@ -1464,7 +1464,7 @@ initable_init (GInitable *initable,
G_CALLBACK (on_control_proxy_g_signal),
weak_ref_new (G_OBJECT (manager)),
(GClosureNotify) weak_ref_free,
0 /* flags */);
G_CONNECT_DEFAULT);
manager->priv->name_owner = g_dbus_proxy_get_name_owner (manager->priv->control_proxy);
if (manager->priv->name_owner == NULL && manager->priv->name != NULL)

View File

@ -630,7 +630,7 @@ g_dbus_server_start (GDBusServer *server)
G_CALLBACK (on_run),
g_object_ref (server),
(GClosureNotify) g_object_unref,
0 /* flags */);
G_CONNECT_DEFAULT);
g_socket_service_start (G_SOCKET_SERVICE (server->listener));
server->active = TRUE;
g_object_notify (G_OBJECT (server), "active");

View File

@ -191,7 +191,7 @@ g_dtls_client_connection_new (GDatagramBased *base_socket,
GTlsCertificateFlags
g_dtls_client_connection_get_validation_flags (GDtlsClientConnection *conn)
{
GTlsCertificateFlags flags = 0;
GTlsCertificateFlags flags = G_TLS_CERTIFICATE_FLAGS_NONE;
g_return_val_if_fail (G_IS_DTLS_CLIENT_CONNECTION (conn), 0);

View File

@ -1580,6 +1580,7 @@ typedef enum {
/**
* GTlsCertificateFlags:
* @G_TLS_CERTIFICATE_FLAGS_NONE: No flags. Since: 2.74
* @G_TLS_CERTIFICATE_UNKNOWN_CA: The signing certificate authority is
* not known.
* @G_TLS_CERTIFICATE_BAD_IDENTITY: The certificate does not match the
@ -1611,6 +1612,7 @@ typedef enum {
* Since: 2.28
*/
typedef enum {
G_TLS_CERTIFICATE_FLAGS_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_TLS_CERTIFICATE_UNKNOWN_CA = (1 << 0),
G_TLS_CERTIFICATE_BAD_IDENTITY = (1 << 1),
G_TLS_CERTIFICATE_NOT_ACTIVATED = (1 << 2),

View File

@ -809,7 +809,8 @@ g_local_file_monitor_start (GLocalFileMonitor *local_monitor,
local_monitor->mount_monitor = g_unix_mount_monitor_get ();
g_signal_connect_object (local_monitor->mount_monitor, "mounts-changed",
G_CALLBACK (g_local_file_monitor_mounts_changed), local_monitor, 0);
G_CALLBACK (g_local_file_monitor_mounts_changed), local_monitor,
G_CONNECT_DEFAULT);
#endif
}
@ -924,7 +925,7 @@ g_local_file_monitor_new_in_worker (const gchar *pathname,
{
if (callback)
g_signal_connect_data (monitor, "changed", G_CALLBACK (callback),
user_data, destroy_user_data, 0 /* flags */);
user_data, destroy_user_data, G_CONNECT_DEFAULT);
g_local_file_monitor_start (monitor, pathname, is_directory, flags, GLIB_PRIVATE_CALL(g_get_worker_context) ());
}

View File

@ -579,10 +579,14 @@ normalise_whitespace (const gchar *orig)
{
GRegex *s;
cleanup[0] = g_regex_new ("^\\s+", 0, 0, 0);
cleanup[1] = g_regex_new ("\\s+$", 0, 0, 0);
cleanup[2] = g_regex_new ("\\s+", 0, 0, 0);
s = g_regex_new ("\\n\\s*\\n+", 0, 0, 0);
cleanup[0] = g_regex_new ("^\\s+", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
cleanup[1] = g_regex_new ("\\s+$", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
cleanup[2] = g_regex_new ("\\s+", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
s = g_regex_new ("\\n\\s*\\n+", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
g_once_init_leave (&splitter, s);
}

View File

@ -756,7 +756,9 @@ g_subprocess_wait_async (GSubprocess *subprocess,
* see the cancellation in the _finish().
*/
if (cancellable)
g_signal_connect_object (cancellable, "cancelled", G_CALLBACK (g_subprocess_wait_cancelled), task, 0);
g_signal_connect_object (cancellable, "cancelled",
G_CALLBACK (g_subprocess_wait_cancelled),
task, G_CONNECT_DEFAULT);
subprocess->pending_waits = g_slist_prepend (subprocess->pending_waits, task);
task = NULL;

View File

@ -1530,7 +1530,8 @@ g_task_start_task_thread (GTask *task,
g_signal_connect_data (task->cancellable, "cancelled",
G_CALLBACK (task_thread_cancelled),
g_object_ref (task),
task_thread_cancelled_disconnect_notify, 0);
task_thread_cancelled_disconnect_notify,
G_CONNECT_DEFAULT);
}
if (g_private_get (&task_private))

View File

@ -1121,6 +1121,8 @@ g_tls_certificate_get_issuer (GTlsCertificate *cert)
* check a certificate against a CA that is not part of the system
* CA database.
*
* If @cert is valid, %G_TLS_CERTIFICATE_FLAGS_NONE is returned.
*
* If @identity is not %NULL, @cert's name(s) will be compared against
* it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return
* value if it does not match. If @identity is %NULL, that bit will

View File

@ -213,7 +213,7 @@ g_tls_client_connection_new (GIOStream *base_io_stream,
GTlsCertificateFlags
g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn)
{
GTlsCertificateFlags flags = 0;
GTlsCertificateFlags flags = G_TLS_CERTIFICATE_FLAGS_NONE;
g_return_val_if_fail (G_IS_TLS_CLIENT_CONNECTION (conn), 0);

View File

@ -827,7 +827,7 @@ test_help (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*Application options*");
}

View File

@ -144,7 +144,7 @@ test_x11_autolaunch (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_stderr_unmatched ("?*");
g_test_trap_assert_stdout ("hello:this=address-is-from-the,mock=dbus-launch\n");
g_test_trap_assert_passed ();
@ -167,7 +167,7 @@ test_xdg_runtime (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_stderr_unmatched ("?*");
g_test_trap_assert_stdout ("unix:path=/tmp/gdbus%2Cunix%2Ctest.*/bus\n");
g_test_trap_assert_passed ();
@ -203,7 +203,7 @@ test_win32_autolaunch (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
/* stderr is not checked: coverage prints warnings there */
g_test_trap_assert_stdout ("nonce-tcp:host=localhost,port=*,noncefile=*\\gdbus-nonce-file-*\n");
g_test_trap_assert_passed ();

View File

@ -222,7 +222,7 @@ test_non_socket (void)
/* This is #ifdef G_OS_UNIX anyway, so just use g_test_trap_fork() */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (!g_test_trap_fork (0, 0))
if (!g_test_trap_fork (0, G_TEST_TRAP_DEFAULT))
{
/* parent */
g_object_unref (streams[0]);

View File

@ -1202,7 +1202,7 @@ test_peer_invalid_server (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*G_DBUS_SERVER_FLAGS_ALL*");
}
@ -1249,7 +1249,7 @@ test_peer_invalid_conn_stream_sync (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*G_DBUS_CONNECTION_FLAGS_ALL*");
}
@ -1295,7 +1295,7 @@ test_peer_invalid_conn_stream_async (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*G_DBUS_CONNECTION_FLAGS_ALL*");
}
@ -1324,7 +1324,7 @@ test_peer_invalid_conn_addr_sync (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*G_DBUS_CONNECTION_FLAGS_ALL*");
}
@ -1347,7 +1347,7 @@ test_peer_invalid_conn_addr_async (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*G_DBUS_CONNECTION_FLAGS_ALL*");
}

View File

@ -80,6 +80,10 @@ test_extension_point (void)
g_assert (g_io_extension_get_priority (ext) == 10);
}
#define INHERIT_ALL (G_TEST_SUBPROCESS_INHERIT_STDIN | \
G_TEST_SUBPROCESS_INHERIT_STDOUT | \
G_TEST_SUBPROCESS_INHERIT_STDERR)
static void
test_module_scan_all (void)
{
@ -105,7 +109,7 @@ test_module_scan_all (void)
g_assert_cmpstr (g_io_extension_get_name (ext), ==, "test-a");
return;
}
g_test_trap_subprocess (NULL, 0, 7);
g_test_trap_subprocess (NULL, 0, INHERIT_ALL);
g_test_trap_assert_passed ();
}
@ -136,7 +140,7 @@ test_module_scan_all_with_scope (void)
g_io_module_scope_free (scope);
return;
}
g_test_trap_subprocess (NULL, 0, 7);
g_test_trap_subprocess (NULL, 0, INHERIT_ALL);
g_test_trap_assert_passed ();
}

View File

@ -71,7 +71,7 @@ test_store_non_gobjects (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*value * of type 'GType' is invalid or "
"out of range for property 'item-type'*");

View File

@ -38,7 +38,7 @@ test_schema (gpointer data)
gchar *child_name;
child_name = g_strdup_printf ("/gschema/%s%s/subprocess/do_compile", test->name, test->opt ? "/opt" : "");
g_test_trap_subprocess (child_name, 0, 0);
g_test_trap_subprocess (child_name, 0, G_TEST_SUBPROCESS_DEFAULT);
g_free (child_name);
if (test->err)

View File

@ -147,7 +147,7 @@ test_unknown_key (void)
g_object_unref (settings);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*does not contain*");
}
@ -170,7 +170,7 @@ test_no_schema (void)
g_assert_null (settings);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*Settings schema 'no.such.schema' is not installed*");
}
@ -220,7 +220,7 @@ test_wrong_path (void)
settings = g_settings_new_with_path ("org.gtk.test", "/wrong-path/");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*but path * specified by schema*");
}
@ -238,7 +238,7 @@ test_no_path (void)
settings = g_settings_new ("org.gtk.test.no-path");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*attempting to create schema * without a path**");
}
@ -1507,7 +1507,7 @@ test_typesafe_binding (void)
g_object_unref (settings);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not compatible*");
}
@ -1665,12 +1665,14 @@ test_no_read_binding (void)
{
if (g_test_undefined ())
{
g_test_trap_subprocess ("/gsettings/no-read-binding/subprocess/fail", 0, 0);
g_test_trap_subprocess ("/gsettings/no-read-binding/subprocess/fail", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*property*is not readable*");
}
g_test_trap_subprocess ("/gsettings/no-read-binding/subprocess/pass", 0, 0);
g_test_trap_subprocess ("/gsettings/no-read-binding/subprocess/pass", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -1708,12 +1710,14 @@ test_no_write_binding (void)
{
if (g_test_undefined ())
{
g_test_trap_subprocess ("/gsettings/no-write-binding/subprocess/fail", 0, 0);
g_test_trap_subprocess ("/gsettings/no-write-binding/subprocess/fail", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*property*is not writable*");
}
g_test_trap_subprocess ("/gsettings/no-write-binding/subprocess/pass", 0, 0);
g_test_trap_subprocess ("/gsettings/no-write-binding/subprocess/pass", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -2141,19 +2145,23 @@ test_enums (void)
if (g_test_undefined () && !backend_set)
{
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-enum-key", 0, 0);
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-enum-key", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not associated with an enum*");
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-enum-value", 0, 0);
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-enum-value", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*invalid enum value 42*");
g_test_trap_subprocess ("/gsettings/enums/subprocess/range", 0, 0);
g_test_trap_subprocess ("/gsettings/enums/subprocess/range", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_settings_set_value*valid range*");
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-flags", 0, 0);
g_test_trap_subprocess ("/gsettings/enums/subprocess/non-flags", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not associated with a flags*");
}
@ -2239,19 +2247,23 @@ test_flags (void)
if (g_test_undefined () && !backend_set)
{
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-flags-key", 0, 0);
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-flags-key", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not associated with a flags*");
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-flags-value", 0, 0);
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-flags-value", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*invalid flags value 0x00000042*");
g_test_trap_subprocess ("/gsettings/flags/subprocess/range", 0, 0);
g_test_trap_subprocess ("/gsettings/flags/subprocess/range", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_settings_set_value*valid range*");
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-enum", 0, 0);
g_test_trap_subprocess ("/gsettings/flags/subprocess/non-enum", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*not associated with an enum*");
}
@ -2328,11 +2340,13 @@ test_range (void)
if (g_test_undefined () && !backend_set)
{
g_test_trap_subprocess ("/gsettings/range/subprocess/high", 0, 0);
g_test_trap_subprocess ("/gsettings/range/subprocess/high", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_settings_set_value*valid range*");
g_test_trap_subprocess ("/gsettings/range/subprocess/low", 0, 0);
g_test_trap_subprocess ("/gsettings/range/subprocess/low", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_settings_set_value*valid range*");
}
@ -2881,7 +2895,8 @@ test_per_desktop (void)
if (!g_test_subprocess ())
{
g_test_trap_subprocess ("/gsettings/per-desktop/subprocess", 0, 0);
g_test_trap_subprocess ("/gsettings/per-desktop/subprocess", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}

View File

@ -2305,7 +2305,7 @@ test_return_in_idle_error_first (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*assertion '!task->ever_returned' failed*");
}
@ -2321,7 +2321,7 @@ test_return_in_idle_value_first (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*assertion '!task->ever_returned' failed*");
}
@ -2337,7 +2337,7 @@ test_return_error_first (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*assertion '!task->ever_returned' failed*");
}
@ -2353,7 +2353,7 @@ test_return_value_first (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*assertion '!task->ever_returned' failed*");
}

View File

@ -40,7 +40,7 @@ get_tls_channel_binding (void)
G_TLS_CHANNEL_BINDING_TLS_UNIQUE, NULL, (GError **)&not_null));
g_object_unref (tls);
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*GLib-GIO-CRITICAL*");
}
@ -75,7 +75,7 @@ get_dtls_channel_binding (void)
G_TLS_CHANNEL_BINDING_TLS_UNIQUE, NULL, (GError **)&not_null));
g_object_unref (dtls);
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*GLib-GIO-CRITICAL*");
}

View File

@ -442,10 +442,12 @@ do_fail_on_broken_utf16_2 (void)
static void
test_fail_on_broken_utf16 (void)
{
g_test_trap_subprocess ("/appinfo/subprocess/win32-assert-broken-utf16_1", 0, 0);
g_test_trap_subprocess ("/appinfo/subprocess/win32-assert-broken-utf16_1", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*GLib-GIO:ERROR:*giowin32-private.c:*:_g_win32_extract_executable: assertion failed: (folded)*");
g_test_trap_subprocess ("/appinfo/subprocess/win32-assert-broken-utf16_2", 0, 0);
g_test_trap_subprocess ("/appinfo/subprocess/win32-assert-broken-utf16_2", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*GLib-GIO:ERROR:*giowin32-private.c:*:_g_win32_extract_executable: assertion failed: (folded)*");
}

View File

@ -1510,7 +1510,7 @@ g_bookmark_file_parse (GBookmarkFile *bookmark,
parse_data->bookmark_file = bookmark;
context = g_markup_parse_context_new (&markup_parser,
0,
G_MARKUP_PARSE_FLAGS_NONE,
parse_data,
(GDestroyNotify) parse_data_free);

View File

@ -946,6 +946,7 @@ g_io_channel_get_line_term (GIOChannel *channel,
**/
/**
* GIOFlags:
* @G_IO_FLAG_NONE: no special flags set. Since: 2.74
* @G_IO_FLAG_APPEND: turns on append mode, corresponds to %O_APPEND
* (see the documentation of the UNIX open() syscall)
* @G_IO_FLAG_NONBLOCK: turns on nonblocking mode, corresponds to

View File

@ -85,6 +85,7 @@ typedef enum
typedef enum
{
G_IO_FLAG_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_IO_FLAG_APPEND = 1 << 0,
G_IO_FLAG_NONBLOCK = 1 << 1,
G_IO_FLAG_IS_READABLE = 1 << 2, /* Read only flag */

View File

@ -400,7 +400,7 @@ g_io_unix_set_flags (GIOChannel *channel,
static GIOFlags
g_io_unix_get_flags (GIOChannel *channel)
{
GIOFlags flags = 0;
GIOFlags flags = G_IO_FLAG_NONE;
glong fcntl_flags;
GIOUnixChannel *unix_channel = (GIOUnixChannel *) channel;

View File

@ -76,6 +76,7 @@ GQuark g_markup_error_quark (void);
/**
* GMarkupParseFlags:
* @G_MARKUP_PARSE_FLAGS_NONE: No special behaviour. Since: 2.74
* @G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG: flag you should not use
* @G_MARKUP_TREAT_CDATA_AS_TEXT: When this flag is set, CDATA marked
* sections are not passed literally to the @passthrough function of
@ -96,6 +97,7 @@ GQuark g_markup_error_quark (void);
*/
typedef enum
{
G_MARKUP_PARSE_FLAGS_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0, /*< nick=none >*/
G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
G_MARKUP_TREAT_CDATA_AS_TEXT = 1 << 1,
G_MARKUP_PREFIX_ERROR_POSITION = 1 << 2,

View File

@ -1653,7 +1653,7 @@ g_regex_match_simple (const gchar *pattern,
GRegex *regex;
gboolean result;
regex = g_regex_new (pattern, compile_options, 0, NULL);
regex = g_regex_new (pattern, compile_options, G_REGEX_MATCH_DEFAULT, NULL);
if (!regex)
return FALSE;
result = g_regex_match_full (regex, string, -1, 0, match_options, NULL, NULL);
@ -1692,7 +1692,7 @@ g_regex_match_simple (const gchar *pattern,
* GRegex *regex;
* GMatchInfo *match_info;
*
* regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
* regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
* g_regex_match (regex, string, 0, &match_info);
* while (g_match_info_matches (match_info))
* {
@ -1768,7 +1768,7 @@ g_regex_match (const GRegex *regex,
* GMatchInfo *match_info;
* GError *error = NULL;
*
* regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
* regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
* g_regex_match_full (regex, string, -1, 0, 0, &match_info, &error);
* while (g_match_info_matches (match_info))
* {
@ -2949,7 +2949,7 @@ g_regex_replace_literal (const GRegex *regex,
* g_hash_table_insert (h, "3", "THREE");
* g_hash_table_insert (h, "4", "FOUR");
*
* reg = g_regex_new ("1|2|3|4", 0, 0, NULL);
* reg = g_regex_new ("1|2|3|4", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
* res = g_regex_replace_eval (reg, text, -1, 0, 0, eval_cb, h, NULL);
* g_hash_table_destroy (h);
*

View File

@ -218,6 +218,7 @@ GQuark g_regex_error_quark (void);
/**
* GRegexCompileFlags:
* @G_REGEX_DEFAULT: No special options set. Since: 2.74
* @G_REGEX_CASELESS: Letters in the pattern match both upper- and
* lowercase letters. This option can be changed within a pattern
* by a "(?i)" option setting.
@ -297,6 +298,7 @@ GQuark g_regex_error_quark (void);
*/
typedef enum
{
G_REGEX_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_REGEX_CASELESS = 1 << 0,
G_REGEX_MULTILINE = 1 << 1,
G_REGEX_DOTALL = 1 << 2,
@ -319,6 +321,7 @@ typedef enum
/**
* GRegexMatchFlags:
* @G_REGEX_MATCH_DEFAULT: No special options set. Since: 2.74
* @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is,
* it is constrained to match only at the first matching point in the
* string that is being searched. This effect can also be achieved by
@ -387,6 +390,7 @@ typedef enum
* adding a new flag. */
typedef enum
{
G_REGEX_MATCH_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_REGEX_MATCH_ANCHORED = 1 << 4,
G_REGEX_MATCH_NOTBOL = 1 << 7,
G_REGEX_MATCH_NOTEOL = 1 << 8,

View File

@ -357,6 +357,7 @@
/**
* GTestSubprocessFlags:
* @G_TEST_SUBPROCESS_DEFAULT: Default behaviour. Since: 2.74
* @G_TEST_SUBPROCESS_INHERIT_STDIN: If this flag is given, the child
* process will inherit the parent's stdin. Otherwise, the child's
* stdin is redirected to `/dev/null`.
@ -3782,7 +3783,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* }
*
* // Reruns this same test in a subprocess
* g_test_trap_subprocess (NULL, 0, 0);
* g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
* g_test_trap_assert_failed ();
* g_test_trap_assert_stderr ("*ERROR*too large*");
* }

View File

@ -426,6 +426,7 @@ void g_test_queue_destroy (GDestroyNotify destroy_func,
/**
* GTestTrapFlags:
* @G_TEST_TRAP_DEFAULT: Default behaviour. Since: 2.74
* @G_TEST_TRAP_SILENCE_STDOUT: Redirect stdout of the test child to
* `/dev/null` so it cannot be observed on the console during test
* runs. The actual output is still captured though to allow later
@ -446,6 +447,7 @@ void g_test_queue_destroy (GDestroyNotify destroy_func,
* #GTestSubprocessFlags.
*/
typedef enum {
G_TEST_TRAP_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_TEST_TRAP_SILENCE_STDOUT = 1 << 7,
G_TEST_TRAP_SILENCE_STDERR = 1 << 8,
G_TEST_TRAP_INHERIT_STDIN = 1 << 9
@ -460,6 +462,7 @@ gboolean g_test_trap_fork (guint64 usec_timeout,
G_GNUC_END_IGNORE_DEPRECATIONS
typedef enum {
G_TEST_SUBPROCESS_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_TEST_SUBPROCESS_INHERIT_STDIN = 1 << 0,
G_TEST_SUBPROCESS_INHERIT_STDOUT = 1 << 1,
G_TEST_SUBPROCESS_INHERIT_STDERR = 1 << 2

View File

@ -861,7 +861,7 @@ array_overflow_append_vals (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*adding 4294967295 to array would overflow*");
}
@ -880,7 +880,7 @@ array_overflow_set_size (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*adding 4294967295 to array would overflow*");
}

View File

@ -243,7 +243,9 @@ static GMarkupParser parser = {
static void
test_g_markup_parse_context (void)
{
g_autoptr(GMarkupParseContext) val = g_markup_parse_context_new (&parser, 0, NULL, NULL);
g_autoptr(GMarkupParseContext) val = g_markup_parse_context_new (&parser,
G_MARKUP_PARSE_FLAGS_NONE,
NULL, NULL);
g_assert_nonnull (val);
}
@ -294,14 +296,16 @@ test_g_rand (void)
static void
test_g_regex (void)
{
g_autoptr(GRegex) val = g_regex_new (".*", 0, 0, NULL);
g_autoptr(GRegex) val = g_regex_new (".*", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
g_assert_nonnull (val);
}
static void
test_g_match_info (void)
{
g_autoptr(GRegex) regex = g_regex_new (".*", 0, 0, NULL);
g_autoptr(GRegex) regex = g_regex_new (".*", G_REGEX_DEFAULT,
G_REGEX_MATCH_DEFAULT, NULL);
g_autoptr(GMatchInfo) match = NULL;
if (!g_regex_match (regex, "hello", 0, &match))

View File

@ -709,9 +709,11 @@ test_convert_embedded_nul (void)
static void
test_locale_to_utf8_embedded_nul (void)
{
g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/utf8", 0, 0);
g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/utf8",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/iconv", 0, 0);
g_test_trap_subprocess ("/conversion/locale-to-utf8/embedded-nul/subprocess/iconv",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -760,9 +762,11 @@ test_locale_to_utf8_embedded_nul_iconv (void)
static void
test_locale_from_utf8_embedded_nul (void)
{
g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/utf8", 0, 0);
g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/utf8",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/iconv", 0, 0);
g_test_trap_subprocess ("/conversion/locale-from-utf8/embedded-nul/subprocess/iconv",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -813,9 +817,11 @@ test_locale_from_utf8_embedded_nul_iconv (void)
static void
test_filename_to_utf8_embedded_nul (void)
{
g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/utf8", 0, 0);
g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/utf8",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/iconv", 0, 0);
g_test_trap_subprocess ("/conversion/filename-to-utf8/embedded-nul/subprocess/iconv",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -870,9 +876,11 @@ test_filename_to_utf8_embedded_nul_iconv (void)
static void
test_filename_from_utf8_embedded_nul (void)
{
g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/utf8", 0, 0);
g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/utf8",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/iconv", 0, 0);
g_test_trap_subprocess ("/conversion/filename-from-utf8/embedded-nul/subprocess/iconv",
0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}

View File

@ -202,7 +202,7 @@ test_datalist_clear (void)
return;
}
g_test_trap_subprocess (NULL, 500000, 0);
g_test_trap_subprocess (NULL, 500000, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}

View File

@ -336,7 +336,7 @@ test_extended_duplicate (void)
if (!g_test_subprocess ())
{
/* Spawn a subprocess and expect it to fail. */
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*Attempted to register an extended error domain for TestError more than once*");
}

View File

@ -2936,7 +2936,7 @@ static void
do_failed_test (const char *test,
const gchar *pattern)
{
g_test_trap_subprocess (test, 1000000, 0);
g_test_trap_subprocess (test, 1000000, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr (pattern);
}

View File

@ -875,7 +875,8 @@ test_recursive_remove_all_subprocess (void)
static void
test_recursive_remove_all (void)
{
g_test_trap_subprocess ("/hash/recursive-remove-all/subprocess", 1000000, 0);
g_test_trap_subprocess ("/hash/recursive-remove-all/subprocess", 1000000,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}

View File

@ -552,7 +552,7 @@ test_double_free (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*corrupted double-linked list detected*");
}

View File

@ -200,48 +200,59 @@ test_default_handler_0x400 (void)
static void
test_default_handler (void)
{
g_test_trap_subprocess ("/logging/default-handler/subprocess/error", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/error", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*ERROR*message1*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/critical", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/critical", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*message2*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/warning", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*message3*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/message", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/message", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*Message*message4*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/info", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/info", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout_unmatched ("*INFO*message5*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/bar-info", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/bar-info", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*INFO*message5*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/baz-debug", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/baz-debug", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*DEBUG*message6*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/debug", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/debug", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*DEBUG*6*6*6*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/debug-stderr", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/debug-stderr", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout_unmatched ("DEBUG");
g_test_trap_assert_stderr ("*DEBUG*6*6*6*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/0x400", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/0x400", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*LOG-0x400*message7*");
g_test_trap_subprocess ("/logging/default-handler/subprocess/would-drop", 0, 0);
g_test_trap_subprocess ("/logging/default-handler/subprocess/would-drop", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -254,7 +265,7 @@ test_fatal_log_mask (void)
g_log ("bu", G_LOG_LEVEL_INFO, "fatal");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
/* G_LOG_LEVEL_INFO isn't printed by default */
g_test_trap_assert_stdout_unmatched ("*fatal*");
@ -361,7 +372,7 @@ test_gibberish (void)
g_warning ("bla bla \236\237\190");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*bla bla \\x9e\\x9f\\u000190*");
}
@ -465,7 +476,7 @@ test_structured_logging_no_state (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -494,7 +505,7 @@ test_structured_logging_some_state (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -517,7 +528,7 @@ test_structured_logging_robustness (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -568,7 +579,7 @@ test_structured_logging_roundtrip1 (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -603,7 +614,7 @@ test_structured_logging_roundtrip2 (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -632,7 +643,7 @@ test_structured_logging_roundtrip3 (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -672,7 +683,7 @@ test_structured_logging_variant1 (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -704,7 +715,7 @@ test_structured_logging_variant2 (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
}
@ -721,7 +732,7 @@ test_structured_logging_set_writer_func_twice (void)
}
else
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
}
}

View File

@ -206,7 +206,9 @@ test_cleanup (void)
if (!g_test_undefined ())
return;
context = g_markup_parse_context_new (&cleanup_parser, 0, NULL, NULL);
context = g_markup_parse_context_new (&cleanup_parser,
G_MARKUP_PARSE_FLAGS_NONE, NULL,
NULL);
g_markup_parse_context_parse (context, XML, -1, NULL);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,

View File

@ -314,7 +314,7 @@ main (int argc, char *argv[])
if (argc > 1)
{
gint arg = 1;
GMarkupParseFlags flags = 0;
GMarkupParseFlags flags = G_MARKUP_PARSE_FLAGS_NONE;
if (strcmp (argv[1], "--cdata-as-text") == 0)
{

View File

@ -289,7 +289,8 @@ test (gconstpointer user_data)
error = NULL;
string = g_string_new (NULL);
ctx = g_markup_parse_context_new (&parser, 0, string, NULL);
ctx = g_markup_parse_context_new (&parser, G_MARKUP_PARSE_FLAGS_NONE,
string, NULL);
result = g_markup_parse_context_parse (ctx, tc->markup,
strlen (tc->markup), &error);
if (result)

View File

@ -80,7 +80,8 @@ test_markup_stack (void)
gboolean res;
GError *error = NULL;
context = g_markup_parse_context_new (&parser, 0, &data, NULL);
context = g_markup_parse_context_new (&parser, G_MARKUP_PARSE_FLAGS_NONE,
&data, NULL);
res = g_markup_parse_context_parse (context, content, -1, &error);
g_assert (res);
g_assert_no_error (error);

View File

@ -139,7 +139,8 @@ mem_overflow (void)
#define CHECK_SUBPROCESS_FAIL(name) do { \
if (g_test_undefined ()) \
{ \
g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, 0); \
g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, \
G_TEST_SUBPROCESS_DEFAULT); \
g_test_trap_assert_failed(); \
} \
} while (0)
@ -147,7 +148,8 @@ mem_overflow (void)
#define CHECK_SUBPROCESS_PASS(name) do { \
if (g_test_undefined ()) \
{ \
g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, 0); \
g_test_trap_subprocess ("/mem/overflow/subprocess/" #name, 0, \
G_TEST_SUBPROCESS_DEFAULT); \
g_test_trap_assert_passed(); \
} \
} while (0)
@ -208,7 +210,8 @@ empty_alloc (void)
g_assert_cmpint (sizeof (Empty), ==, 0);
g_test_trap_subprocess ("/mem/empty-alloc/subprocess", 0, 0);
g_test_trap_subprocess ("/mem/empty-alloc/subprocess", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
#endif

View File

@ -100,7 +100,7 @@ test_grefcount_saturation (void)
exit (0);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
#if defined (G_DISABLE_CHECKS) && defined (__GNUC__)
/* With checks disabled we don't get any warning */
@ -193,7 +193,7 @@ test_gatomicrefcount_saturation (void)
exit (0);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
#if defined (G_DISABLE_CHECKS) && defined (__GNUC__)
/* With checks disabled we don't get any warning */

View File

@ -286,7 +286,7 @@ test_match_next (gconstpointer d)
GSList *matches;
GSList *l_exp, *l_match;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -478,7 +478,7 @@ test_match_count (gconstpointer d)
GMatchInfo *match_info;
gint count;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -515,7 +515,7 @@ test_partial (gconstpointer d)
GRegex *regex;
GMatchInfo *match_info;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -567,7 +567,7 @@ test_sub_pattern (gconstpointer d)
gchar *sub_expr;
gint start = UNTOUCHED, end = UNTOUCHED;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -622,7 +622,7 @@ test_named_sub_pattern (gconstpointer d)
gint start = UNTOUCHED, end = UNTOUCHED;
gchar *sub_expr;
regex = g_regex_new (data->pattern, data->flags, 0, NULL);
regex = g_regex_new (data->pattern, data->flags, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -694,7 +694,7 @@ test_fetch_all (gconstpointer d)
gint match_count;
gint i;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -788,7 +788,8 @@ test_split_simple (gconstpointer d)
gint token_count;
gint i;
tokens = g_regex_split_simple (data->pattern, data->string, 0, 0);
tokens = g_regex_split_simple (data->pattern, data->string,
G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
if (tokens)
token_count = g_strv_length (tokens);
else
@ -867,7 +868,7 @@ test_split_full (gconstpointer d)
gint token_count;
gint i;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -901,7 +902,7 @@ test_split (gconstpointer d)
gint token_count;
gint i;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert (regex != NULL);
@ -1057,8 +1058,8 @@ test_expand (gconstpointer d)
if (data->pattern)
{
regex = g_regex_new (data->pattern, data->raw ? G_REGEX_RAW : 0, 0,
&error);
regex = g_regex_new (data->pattern, data->raw ? G_REGEX_RAW : 0,
G_REGEX_MATCH_DEFAULT, &error);
g_assert_no_error (error);
g_regex_match (regex, data->string, 0, &match_info);
}
@ -1100,7 +1101,7 @@ test_replace (gconstpointer d)
GRegex *regex;
gchar *res;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
res = g_regex_replace (regex, data->string, -1, data->start_position, data->replacement, 0, NULL);
g_assert_cmpstr (res, ==, data->expected);
@ -1130,7 +1131,7 @@ test_replace_lit (gconstpointer d)
GRegex *regex;
gchar *res;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
res = g_regex_replace_literal (regex, data->string, -1, data->start_position,
data->replacement, 0, NULL);
g_assert_cmpstr (res, ==, data->expected);
@ -1166,7 +1167,7 @@ test_get_string_number (gconstpointer d)
GRegex *regex;
gint num;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
num = g_regex_get_string_number (regex, data->name);
g_assert_cmpint (num, ==, data->expected_num);
@ -1260,7 +1261,7 @@ test_match_all_full (gconstpointer d)
gint match_count;
gint i;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
match_ok = g_regex_match_all_full (regex, data->string, data->string_len, data->start_position,
0, &match_info, NULL);
@ -1305,7 +1306,7 @@ test_match_all (gconstpointer d)
gboolean match_ok;
guint i, match_count;
regex = g_regex_new (data->pattern, 0, 0, NULL);
regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
match_ok = g_regex_match_all (regex, data->string, 0, &match_info);
if (g_slist_length (data->expected) == 0)
@ -1502,7 +1503,7 @@ test_properties (void)
gchar *str;
error = NULL;
regex = g_regex_new ("\\p{L}\\p{Ll}\\p{Lu}\\p{L&}\\p{N}\\p{Nd}", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("\\p{L}\\p{Ll}\\p{Lu}\\p{L&}\\p{N}\\p{Nd}", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
res = g_regex_match (regex, "ppPP01", 0, &match);
g_assert (res);
str = g_match_info_fetch (match, 0);
@ -1523,7 +1524,7 @@ test_class (void)
gchar *str;
error = NULL;
regex = g_regex_new ("[abc\\x{0B1E}\\p{Mn}\\x{0391}-\\x{03A9}]", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("[abc\\x{0B1E}\\p{Mn}\\x{0391}-\\x{03A9}]", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
res = g_regex_match (regex, "a:b:\340\254\236:\333\253:\316\240", 0, &match);
g_assert (res);
str = g_match_info_fetch (match, 0);
@ -1569,7 +1570,7 @@ test_lookahead (void)
gint start, end;
error = NULL;
regex = g_regex_new ("\\w+(?=;)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("\\w+(?=;)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "word1 word2: word3;", 0, &match);
@ -1583,7 +1584,7 @@ test_lookahead (void)
g_regex_unref (regex);
error = NULL;
regex = g_regex_new ("foo(?!bar)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("foo(?!bar)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "foobar foobaz", 0, &match);
@ -1598,7 +1599,7 @@ test_lookahead (void)
g_regex_unref (regex);
error = NULL;
regex = g_regex_new ("(?!bar)foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?!bar)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "foobar foobaz", 0, &match);
@ -1631,7 +1632,7 @@ test_lookbehind (void)
gint start, end;
error = NULL;
regex = g_regex_new ("(?<!foo)bar", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<!foo)bar", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "foobar boobar", 0, &match);
@ -1646,7 +1647,7 @@ test_lookbehind (void)
g_regex_unref (regex);
error = NULL;
regex = g_regex_new ("(?<=bullock|donkey) poo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=bullock|donkey) poo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "don poo, and bullock poo", 0, &match);
@ -1659,17 +1660,17 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<!dogs?|cats?) x", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<!dogs?|cats?) x", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex == NULL);
g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND);
g_clear_error (&error);
regex = g_regex_new ("(?<=ab(c|de)) foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=ab(c|de)) foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex == NULL);
g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND);
g_clear_error (&error);
regex = g_regex_new ("(?<=abc|abde)foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=abc|abde)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abfoo, abdfoo, abcfoo", 0, &match);
@ -1681,7 +1682,7 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^.*+(?<=abcd)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^.*+(?<=abcd)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abcabcabcabcabcabcabcabcabcd", 0, &match);
@ -1690,7 +1691,7 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<=\\d{3})(?<!999)foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=\\d{3})(?<!999)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
@ -1702,7 +1703,7 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<=\\d{3}...)(?<!999)foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=\\d{3}...)(?<!999)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
@ -1714,7 +1715,7 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<=\\d{3}(?!999)...)foo", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=\\d{3}(?!999)...)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
@ -1726,7 +1727,7 @@ test_lookbehind (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<=(?<!foo)bar)baz", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?<=(?<!foo)bar)baz", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "foobarbaz barfoobaz barbarbaz", 0, &match);
@ -1751,7 +1752,7 @@ test_subpattern (void)
gint start;
error = NULL;
regex = g_regex_new ("cat(aract|erpillar|)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("cat(aract|erpillar|)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
g_assert_cmpint (g_regex_get_capture_count (regex), ==, 1);
@ -1769,7 +1770,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("the ((red|white) (king|queen))", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("the ((red|white) (king|queen))", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
g_assert_cmpint (g_regex_get_capture_count (regex), ==, 3);
@ -1793,7 +1794,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("the ((?:red|white) (king|queen))", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("the ((?:red|white) (king|queen))", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "the white queen", 0, &match);
@ -1813,7 +1814,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?|(Sat)(ur)|(Sun))day (morning|afternoon)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?|(Sat)(ur)|(Sun))day (morning|afternoon)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
g_assert_cmpint (g_regex_get_capture_count (regex), ==, 3);
@ -1833,7 +1834,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?|(abc)|(def))\\1", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?|(abc)|(def))\\1", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
g_assert_cmpint (g_regex_get_max_backref (regex), ==, 1);
@ -1851,7 +1852,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?|(abc)|(def))(?1)", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("(?|(abc)|(def))(?1)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abcabc abcdef defabc defdef", 0, &match);
@ -1868,7 +1869,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, 0, &error);
regex = g_regex_new ("(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "Mon Tuesday Wed Saturday", 0, &match);
@ -1895,7 +1896,7 @@ test_subpattern (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^(a|b\\1)+$", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, 0, &error);
regex = g_regex_new ("^(a|b\\1)+$", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "aaaaaaaaaaaaaaaa", 0, &match);
@ -1919,7 +1920,7 @@ test_condition (void)
gboolean res;
error = NULL;
regex = g_regex_new ("^(a+)(\\()?[^()]+(?(-1)\\))(b+)$", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^(a+)(\\()?[^()]+(?(-1)\\))(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "a(zzzzzz)b", 0, &match);
@ -1933,7 +1934,7 @@ test_condition (void)
g_regex_unref (regex);
error = NULL;
regex = g_regex_new ("^(a+)(?<OPEN>\\()?[^()]+(?(<OPEN>)\\))(b+)$", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^(a+)(?<OPEN>\\()?[^()]+(?(<OPEN>)\\))(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "a(zzzzzz)b", 0, &match);
@ -1946,7 +1947,7 @@ test_condition (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^(a+)(?(+1)\\[|\\<)?[^()]+(\\])?(b+)$", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^(a+)(?(+1)\\[|\\<)?[^()]+(\\])?(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "a[zzzzzz]b", 0, &match);
@ -2013,7 +2014,7 @@ test_recursion (void)
gint start;
error = NULL;
regex = g_regex_new ("\\( ( [^()]++ | (?R) )* \\)", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
regex = g_regex_new ("\\( ( [^()]++ | (?R) )* \\)", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "(middle)", 0, &match);
@ -2030,7 +2031,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^( \\( ( [^()]++ | (?1) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
regex = g_regex_new ("^( \\( ( [^()]++ | (?1) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "((((((((((((((((middle))))))))))))))))", 0, &match);
@ -2043,7 +2044,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^(?<pn> \\( ( [^()]++ | (?&pn) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
regex = g_regex_new ("^(?<pn> \\( ( [^()]++ | (?&pn) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
g_regex_match (regex, "(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()", 0, &match);
@ -2052,7 +2053,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
regex = g_regex_new ("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "<ab<01<23<4>>>>", 0, &match);
@ -2071,7 +2072,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^((.)(?1)\\2|.)$", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^((.)(?1)\\2|.)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abcdcba", 0, &match);
@ -2084,7 +2085,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^(?:((.)(?1)\\2|)|((.)(?3)\\4|.))$", G_REGEX_OPTIMIZE, 0, &error);
regex = g_regex_new ("^(?:((.)(?1)\\2|)|((.)(?3)\\4|.))$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abcdcba", 0, &match);
@ -2097,7 +2098,7 @@ test_recursion (void)
g_match_info_free (match);
g_regex_unref (regex);
regex = g_regex_new ("^\\W*+(?:((.)\\W*+(?1)\\W*+\\2|)|((.)\\W*+(?3)\\W*+\\4|\\W*+.\\W*+))\\W*+$", G_REGEX_OPTIMIZE|G_REGEX_CASELESS, 0, &error);
regex = g_regex_new ("^\\W*+(?:((.)\\W*+(?1)\\W*+\\2|)|((.)\\W*+(?3)\\W*+\\4|\\W*+.\\W*+))\\W*+$", G_REGEX_OPTIMIZE|G_REGEX_CASELESS, G_REGEX_MATCH_DEFAULT, &error);
g_assert (regex);
g_assert_no_error (error);
res = g_regex_match (regex, "abcdcba", 0, &match);
@ -2124,7 +2125,7 @@ test_multiline (void)
g_test_bug ("https://bugzilla.gnome.org/show_bug.cgi?id=640489");
regex = g_regex_new ("^a$", G_REGEX_MULTILINE|G_REGEX_DOTALL, 0, NULL);
regex = g_regex_new ("^a$", G_REGEX_MULTILINE|G_REGEX_DOTALL, G_REGEX_MATCH_DEFAULT, NULL);
count = 0;
g_regex_match (regex, "a\nb\na", 0, &info);
@ -2144,7 +2145,7 @@ test_explicit_crlf (void)
{
GRegex *regex;
regex = g_regex_new ("[\r\n]a", 0, 0, NULL);
regex = g_regex_new ("[\r\n]a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert_cmpint (g_regex_get_has_cr_or_lf (regex), ==, TRUE);
g_regex_unref (regex);
}
@ -2154,15 +2155,15 @@ test_max_lookbehind (void)
{
GRegex *regex;
regex = g_regex_new ("abc", 0, 0, NULL);
regex = g_regex_new ("abc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 0);
g_regex_unref (regex);
regex = g_regex_new ("\\babc", 0, 0, NULL);
regex = g_regex_new ("\\babc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 1);
g_regex_unref (regex);
regex = g_regex_new ("(?<=123)abc", 0, 0, NULL);
regex = g_regex_new ("(?<=123)abc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 3);
g_regex_unref (regex);
}
@ -2205,25 +2206,25 @@ main (int argc, char *argv[])
/* TEST_NEW(pattern, compile_opts, match_opts) */
TEST_NEW("[A-Z]+", G_REGEX_CASELESS | G_REGEX_EXTENDED | G_REGEX_OPTIMIZE, G_REGEX_MATCH_NOTBOL | G_REGEX_MATCH_PARTIAL);
TEST_NEW("", 0, 0);
TEST_NEW(".*", 0, 0);
TEST_NEW(".*", G_REGEX_OPTIMIZE, 0);
TEST_NEW(".*", G_REGEX_MULTILINE, 0);
TEST_NEW(".*", G_REGEX_DOTALL, 0);
TEST_NEW("", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW(".*", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW(".*", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
TEST_NEW(".*", G_REGEX_MULTILINE, G_REGEX_MATCH_DEFAULT);
TEST_NEW(".*", G_REGEX_DOTALL, G_REGEX_MATCH_DEFAULT);
TEST_NEW(".*", G_REGEX_DOTALL, G_REGEX_MATCH_NOTBOL);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", 0, 0);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS, 0);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS | G_REGEX_OPTIMIZE, 0);
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES, 0);
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, 0);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS, G_REGEX_MATCH_DEFAULT);
TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS | G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT);
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
/* This gives "internal error: code overflow" with pcre 6.0 */
TEST_NEW("(?i)(?-i)", 0, 0);
TEST_NEW ("(?i)a", 0, 0);
TEST_NEW ("(?m)a", 0, 0);
TEST_NEW ("(?s)a", 0, 0);
TEST_NEW ("(?x)a", 0, 0);
TEST_NEW ("(?J)a", 0, 0);
TEST_NEW ("(?U)[a-z]+", 0, 0);
TEST_NEW("(?i)(?-i)", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?i)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?m)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?s)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?x)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?J)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
TEST_NEW ("(?U)[a-z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
/* TEST_NEW_CHECK_FLAGS(pattern, compile_opts, match_ops, real_compile_opts, real_match_opts) */
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_OPTIMIZE, 0, G_REGEX_OPTIMIZE, 0);

View File

@ -70,7 +70,7 @@ test_scanner_error (ScannerFixture *fix,
exit (0);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*scanner-error-message-test*");
}

View File

@ -25,7 +25,7 @@ test_slice_nodebug (void)
g_slice_debug_tree_statistics ();
return;
}
g_test_trap_subprocess (NULL, 1000000, 0);
g_test_trap_subprocess (NULL, 1000000, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*GSlice: MemChecker: root=NULL*");
@ -53,7 +53,7 @@ test_slice_debug (void)
g_slice_debug_tree_statistics ();
return;
}
g_test_trap_subprocess (NULL, 1000000, 0);
g_test_trap_subprocess (NULL, 1000000, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*GSlice: MemChecker: * trunks, * branches, * old branches*");

View File

@ -401,7 +401,7 @@ test_spawn_stderr_socket (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}

View File

@ -639,7 +639,7 @@ test_positional_params2 (void)
g_assert_cmpint (res, ==, 7);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("a b\n ab\nabcabc\n");
}
@ -674,7 +674,7 @@ test_percent2 (void)
g_assert_cmpint (res, ==, 1);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*%*");
}
@ -858,13 +858,15 @@ _Pragma ("GCC diagnostic pop")
static void
test_64bit2 (void)
{
g_test_trap_subprocess ("/printf/test-64bit/subprocess/base", 0, 0);
g_test_trap_subprocess ("/printf/test-64bit/subprocess/base", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("123456\n-123456\n123456\n"
"361100\n0361100\n1e240\n"
"0x1e240\n1E240\n");
#ifdef G_OS_WIN32
g_test_trap_subprocess ("/printf/test-64bit/subprocess/win32", 0, 0);
g_test_trap_subprocess ("/printf/test-64bit/subprocess/win32", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("123456\n-123456\n123456\n"
"361100\n0361100\n1e240\n"

View File

@ -208,56 +208,69 @@ test_assertions (void)
g_variant_unref (v2);
g_variant_unref (v1);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_types", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_types", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_values", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpvariant_values", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstr", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstr", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null1", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null1", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null2", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_null2", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_length", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_length", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_values", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpstrv_values", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpint", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpint", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_len", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_len", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*len*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_data", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_data", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_assert_stderr_unmatched ("*assertion failed*len*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_null", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpmem_null", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*NULL*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_cmpfloat_epsilon", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_no_errno", 0, 0);
g_test_trap_subprocess ("/misc/assertions/subprocess/bad_no_errno", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*");
}
@ -312,7 +325,7 @@ static void
test_fork_timeout (void)
{
/* allow child to run for only a fraction of a second */
if (g_test_trap_fork (0.11 * 1000000, 0))
if (g_test_trap_fork (0.11 * 1000000, G_TEST_TRAP_DEFAULT))
{
/* loop and sleep forever */
while (TRUE)
@ -334,7 +347,7 @@ test_subprocess_fail (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*ERROR*test_subprocess_fail*should not be reached*");
}
@ -344,11 +357,12 @@ test_subprocess_no_such_test (void)
{
if (g_test_subprocess ())
{
g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0, 0);
g_test_trap_subprocess ("/trap_subprocess/this-test-does-not-exist", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_assert_not_reached ();
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*test does not exist*");
g_test_trap_assert_stderr_unmatched ("*should not be reached*");
@ -363,7 +377,7 @@ test_subprocess_patterns (void)
g_printerr ("some stderr text: semagic43\n");
exit (0);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*somagic17*");
g_test_trap_assert_stderr ("*semagic43*");
@ -380,7 +394,7 @@ test_subprocess_timeout (void)
return;
}
/* allow child to run for only a fraction of a second */
g_test_trap_subprocess (NULL, 0.11 * 1000000, 0);
g_test_trap_subprocess (NULL, 0.11 * 1000000, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_assert_true (g_test_trap_reached_timeout ());
}
@ -508,16 +522,19 @@ test_fatal_log_handler_critical_fail (void)
static void
test_fatal_log_handler (void)
{
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-pass", 0, 0);
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-pass", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*");
g_test_trap_assert_stderr ("*CRITICAL*Test passing*");
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/error-fail", 0, 0);
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/error-fail", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*ERROR*Test failing*");
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-fail", 0, 0);
g_test_trap_subprocess ("/misc/fatal-log-handler/subprocess/critical-fail", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_str_has_prefix*");
g_test_trap_assert_stderr_unmatched ("*CRITICAL*Test passing*");
@ -612,34 +629,41 @@ test_expected_messages_unexpected_extra_warning (void)
static void
test_expected_messages (void)
{
g_test_trap_subprocess ("/misc/expected-messages/subprocess/warning", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*This is a * warning*");
g_test_trap_assert_stderr_unmatched ("*should not be reached*");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/expect-warning", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/expect-warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr_unmatched ("*This is a * warning*");
g_test_trap_assert_stderr ("*should not be reached*");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/wrong-warning", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/wrong-warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr_unmatched ("*should not be reached*");
g_test_trap_assert_stderr ("*GLib-CRITICAL*Did not see expected message testing-CRITICAL*should not be *WARNING*This is a * warning*");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/expected", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/expected", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/null-domain", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/null-domain", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/extra-warning", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/extra-warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("");
g_test_trap_subprocess ("/misc/expected-messages/subprocess/unexpected-extra-warning", 0, 0);
g_test_trap_subprocess ("/misc/expected-messages/subprocess/unexpected-extra-warning", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*GLib:ERROR*Did not see expected message testing-CRITICAL*nope*");
}
@ -718,7 +742,8 @@ test_dash_p_child_sub_child (void)
static void
test_dash_p (void)
{
g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden", 0, 0);
g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub ran*");
@ -726,7 +751,8 @@ test_dash_p (void)
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/sub/subprocess ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*");
g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden/sub", 0, 0);
g_test_trap_subprocess ("/misc/dash-p/subprocess/hidden/sub", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*Test /misc/dash-p/subprocess/hidden/sub ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden ran*");
@ -734,7 +760,8 @@ test_dash_p (void)
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden/subprocess ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child*");
g_test_trap_subprocess ("/misc/dash-p/child", 0, 0);
g_test_trap_subprocess ("/misc/dash-p/child", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*Test /misc/dash-p/child ran*");
g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*");
@ -742,7 +769,8 @@ test_dash_p (void)
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child/subprocess ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/subprocess/hidden*");
g_test_trap_subprocess ("/misc/dash-p/child/sub", 0, 0);
g_test_trap_subprocess ("/misc/dash-p/child/sub", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*Test /misc/dash-p/child/sub ran*");
g_test_trap_assert_stdout_unmatched ("*Test /misc/dash-p/child ran*");
@ -761,7 +789,7 @@ test_nonfatal (void)
g_print ("The End\n");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*assertion failed*4 == 5*");
g_test_trap_assert_stdout ("*The End*");
@ -800,7 +828,7 @@ test_fail (void)
subprocess_fail ();
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
}
@ -822,7 +850,7 @@ test_incomplete (void)
subprocess_incomplete ();
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
/* An incomplete test represents functionality that is known not to be
* implemented yet (an expected failure), so it does not cause test
* failure; but it does count as the test having been skipped, which
@ -839,7 +867,7 @@ test_subprocess_timed_out (void)
g_usleep (1000000);
return;
}
g_test_trap_subprocess (NULL, 50000, 0);
g_test_trap_subprocess (NULL, 50000, G_TEST_SUBPROCESS_DEFAULT);
g_assert_true (g_test_trap_reached_timeout ());
}

View File

@ -108,7 +108,7 @@ test_create_first_pool (gconstpointer shared_first)
if (!g_test_subprocess ())
{
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
return;
}

View File

@ -523,7 +523,7 @@ test_debug (void)
g_assert_cmpint (res, ==, 0);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stderr ("*Supported debug values: key1 key2 key3 all help*");
}
@ -553,7 +553,7 @@ test_codeset2 (void)
g_assert_cmpstr (c, ==, "UTF-8");
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
}
@ -956,7 +956,8 @@ test_aligned_mem (void)
if (g_test_undefined ()) \
{ \
g_test_message (msg); \
g_test_trap_subprocess ("/utils/aligned-mem/subprocess/" #name, 0, 0); \
g_test_trap_subprocess ("/utils/aligned-mem/subprocess/" #name, 0, \
G_TEST_SUBPROCESS_DEFAULT); \
g_test_trap_assert_failed (); \
} \
} while (0)
@ -1024,7 +1025,7 @@ test_atexit (void)
g_atexit (atexit_func);
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_passed ();
g_test_trap_assert_stdout ("*atexit called*");
}

View File

@ -99,7 +99,8 @@ test_veh_crash_access_violation (void)
{
g_unsetenv ("G_DEBUGGER");
/* Run a test that crashes */
g_test_trap_subprocess ("/win32/subprocess/access_violation", 0, 0);
g_test_trap_subprocess ("/win32/subprocess/access_violation", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
}
@ -108,7 +109,8 @@ test_veh_crash_illegal_instruction (void)
{
g_unsetenv ("G_DEBUGGER");
/* Run a test that crashes */
g_test_trap_subprocess ("/win32/subprocess/illegal_instruction", 0, 0);
g_test_trap_subprocess ("/win32/subprocess/illegal_instruction", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
}
@ -125,7 +127,8 @@ test_veh_debug (void)
g_setenv ("G_DEBUGGER_OLD_CONSOLE", "1", TRUE);
g_free (command);
/* Run a test that crashes and runs a debugger */
g_test_trap_subprocess ("/win32/subprocess/debuggee", 0, 0);
g_test_trap_subprocess ("/win32/subprocess/debuggee", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("Debugger invoked, attaching to*");
}

View File

@ -3093,8 +3093,8 @@ g_object_get_property (GObject *object,
*
* The signal specs expected by this function have the form
* "modifier::signal_name", where modifier can be one of the following:
* - signal: equivalent to g_signal_connect_data (..., NULL, 0)
* - object-signal, object_signal: equivalent to g_signal_connect_object (..., 0)
* - signal: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_DEFAULT)
* - object-signal, object_signal: equivalent to g_signal_connect_object (..., G_CONNECT_DEFAULT)
* - swapped-signal, swapped_signal: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)
* - swapped_object_signal, swapped-object-signal: equivalent to g_signal_connect_object (..., G_CONNECT_SWAPPED)
* - signal_after, signal-after: equivalent to g_signal_connect_data (..., NULL, G_CONNECT_AFTER)
@ -3135,12 +3135,12 @@ g_object_connect (gpointer _object,
if (strncmp (signal_spec, "signal::", 8) == 0)
g_signal_connect_data (object, signal_spec + 8,
callback, data, NULL,
0);
G_CONNECT_DEFAULT);
else if (strncmp (signal_spec, "object_signal::", 15) == 0 ||
strncmp (signal_spec, "object-signal::", 15) == 0)
g_signal_connect_object (object, signal_spec + 15,
callback, data,
0);
G_CONNECT_DEFAULT);
else if (strncmp (signal_spec, "swapped_signal::", 16) == 0 ||
strncmp (signal_spec, "swapped-signal::", 16) == 0)
g_signal_connect_data (object, signal_spec + 16,

View File

@ -155,9 +155,11 @@ typedef enum
#define G_SIGNAL_FLAGS_MASK 0x1ff
/**
* GConnectFlags:
* @G_CONNECT_AFTER: whether the handler should be called before or after the
* default handler of the signal.
* @G_CONNECT_SWAPPED: whether the instance and data should be swapped when
* @G_CONNECT_DEFAULT: Default behaviour (no special flags). Since: 2.74
* @G_CONNECT_AFTER: If set, the handler should be called after the
* default handler of the signal. Normally, the handler is called before
* the default handler.
* @G_CONNECT_SWAPPED: If set, the instance and data should be swapped when
* calling the handler; see g_signal_connect_swapped() for an example.
*
* The connection flags are used to specify the behaviour of a signal's
@ -165,6 +167,7 @@ typedef enum
*/
typedef enum
{
G_CONNECT_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_CONNECT_AFTER = 1 << 0,
G_CONNECT_SWAPPED = 1 << 1
} GConnectFlags;
@ -504,6 +507,8 @@ void g_signal_chain_from_overridden_handler (gpointer instance,
*
* Returns: the handler ID, of type #gulong (always greater than 0 for successful connections)
*/
/* Intentionally not using G_CONNECT_DEFAULT here to avoid deprecation
* warnings with older GLIB_VERSION_MAX_ALLOWED */
#define g_signal_connect(instance, detailed_signal, c_handler, data) \
g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0)
/**

View File

@ -1030,6 +1030,8 @@ typedef void (*GTypeInterfaceCheckFunc) (gpointer check_data,
*/
typedef enum /*< skip >*/
{
/* There is no G_TYPE_FUNDAMENTAL_FLAGS_NONE: this is implemented to use
* the same bits as GTypeFlags */
G_TYPE_FLAG_CLASSED = (1 << 0),
G_TYPE_FLAG_INSTANTIATABLE = (1 << 1),
G_TYPE_FLAG_DERIVABLE = (1 << 2),
@ -1037,6 +1039,7 @@ typedef enum /*< skip >*/
} GTypeFundamentalFlags;
/**
* GTypeFlags:
* @G_TYPE_FLAG_NONE: No special flags. Since: 2.74
* @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be
* created for an abstract type
* @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type
@ -1049,6 +1052,7 @@ typedef enum /*< skip >*/
*/
typedef enum /*< skip >*/
{
G_TYPE_FLAG_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_TYPE_FLAG_ABSTRACT = (1 << 4),
G_TYPE_FLAG_VALUE_ABSTRACT = (1 << 5),
G_TYPE_FLAG_FINAL GLIB_AVAILABLE_ENUMERATOR_IN_2_70 = (1 << 6)
@ -2180,6 +2184,8 @@ type_name##_get_type_once (void) \
_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
/* Intentionally using (GTypeFlags) 0 instead of G_TYPE_FLAG_NONE here,
* to avoid deprecation warnings with older GLIB_VERSION_MAX_ALLOWED */
#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \
\
static void type_name##_default_init (TypeName##Interface *klass); \

View File

@ -281,7 +281,7 @@ test_boxed_regex (void)
g_value_init (&value, G_TYPE_REGEX);
g_assert (G_VALUE_HOLDS_BOXED (&value));
v = g_regex_new ("a+b+", 0, 0, NULL);
v = g_regex_new ("a+b+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
g_value_take_boxed (&value, v);
v2 = g_value_get_boxed (&value);
@ -305,7 +305,7 @@ test_boxed_matchinfo (void)
g_value_init (&value, G_TYPE_MATCH_INFO);
g_assert (G_VALUE_HOLDS_BOXED (&value));
r = g_regex_new ("ab", 0, 0, NULL);
r = g_regex_new ("ab", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
ret = g_regex_match (r, "blabla abab bla", 0, &info);
g_assert (ret);
g_value_take_boxed (&value, info);
@ -560,7 +560,8 @@ test_boxed_markup (void)
g_value_init (&value, G_TYPE_MARKUP_PARSE_CONTEXT);
g_assert (G_VALUE_HOLDS_BOXED (&value));
c = g_markup_parse_context_new (&parser, 0, NULL, NULL);
c = g_markup_parse_context_new (&parser, G_MARKUP_PARSE_FLAGS_NONE,
NULL, NULL);
g_value_take_boxed (&value, c);
c2 = g_value_get_boxed (&value);

View File

@ -750,7 +750,7 @@ test_param_invalid_name (gconstpointer test_data)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_param_spec_is_valid_name (name)*");
}
@ -1395,7 +1395,8 @@ test_param_implement (void)
test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
change_this_flag, change_this_type,
use_this_flag, use_this_type);
g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND, 0);
g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND,
G_TEST_SUBPROCESS_DEFAULT);
g_free (test_path);
/* We want to ensure that any flags mismatch problems are reported first. */

View File

@ -582,7 +582,7 @@ properties_testv_with_invalid_property_type (void)
g_object_unref (test_obj);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*foo*gint*gchararray*");
}
@ -620,7 +620,7 @@ properties_testv_with_invalid_property_names (void)
g_object_unref (test_obj);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_object_new_is_valid_property*boo*");
}

View File

@ -1109,8 +1109,10 @@ test_destroy_target_object (void)
sender = g_object_new (test_get_type (), NULL);
target1 = g_object_new (test_get_type (), NULL);
target2 = g_object_new (test_get_type (), NULL);
g_signal_connect_object (sender, "simple", G_CALLBACK (simple_handler1), target1, 0);
g_signal_connect_object (sender, "simple", G_CALLBACK (simple_handler2), target2, 0);
g_signal_connect_object (sender, "simple", G_CALLBACK (simple_handler1),
target1, G_CONNECT_DEFAULT);
g_signal_connect_object (sender, "simple", G_CALLBACK (simple_handler2),
target2, G_CONNECT_DEFAULT);
g_signal_emit_by_name (sender, "simple");
g_object_unref (sender);
}
@ -1638,7 +1640,7 @@ test_lookup_invalid (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*unable to look up invalid signal name*");
}
@ -1755,7 +1757,7 @@ test_signals_invalid_name (gconstpointer test_data)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_signal_is_valid_name (signal_name)*");
}

View File

@ -52,7 +52,8 @@ test_assert_finalize_object (void)
g_assert_finalize_object (obj);
g_test_trap_subprocess ("/assert/finalize_object/subprocess/bad", 0, 0);
g_test_trap_subprocess ("/assert/finalize_object/subprocess/bad", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_assert_finalize_object:*'weak_pointer' should be NULL*");
}