mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
gio: Use g_memdup2() instead of g_memdup() in obvious places
Convert all the call sites which use `g_memdup()`’s length argument trivially (for example, by passing a `sizeof()`), so that they use `g_memdup2()` instead. In almost all of these cases the use of `g_memdup()` would not have caused problems, but it will soon be deprecated, so best port away from it. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #2319
This commit is contained in:
@@ -147,9 +147,9 @@ prepare_data (SetupData *data,
|
||||
|
||||
data->expected_size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (data->data_stream));
|
||||
|
||||
g_assert_cmpint (data->expected_size, >, 0);
|
||||
g_assert_cmpuint (data->expected_size, >, 0);
|
||||
|
||||
data->expected_output = g_memdup (written, (guint)data->expected_size);
|
||||
data->expected_output = g_memdup2 (written, data->expected_size);
|
||||
|
||||
/* then recreate the streams and prepare them for the asynchronous close */
|
||||
destroy_streams (data);
|
||||
|
@@ -671,7 +671,7 @@ subtree_introspect (GDBusConnection *connection,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return g_memdup (interfaces, 2 * sizeof (void *));
|
||||
return g_memdup2 (interfaces, 2 * sizeof (void *));
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable *
|
||||
@@ -727,7 +727,7 @@ dynamic_subtree_introspect (GDBusConnection *connection,
|
||||
{
|
||||
const GDBusInterfaceInfo *interfaces[2] = { &dyna_interface_info, NULL };
|
||||
|
||||
return g_memdup (interfaces, 2 * sizeof (void *));
|
||||
return g_memdup2 (interfaces, 2 * sizeof (void *));
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable *
|
||||
|
Reference in New Issue
Block a user