mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
gdk: Stop using g_slice
This commit is contained in:
parent
15d73a1adb
commit
98ff6c0d4d
@ -750,7 +750,7 @@ static void
|
||||
free_value (gpointer value)
|
||||
{
|
||||
g_value_unset (value);
|
||||
g_slice_free (GValue, value);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -771,7 +771,7 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
task = g_task_new (clipboard, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, source_tag);
|
||||
value = g_slice_new0 (GValue);
|
||||
value = g_new0 (GValue, 1);
|
||||
g_value_init (value, type);
|
||||
g_task_set_task_data (task, value, free_value);
|
||||
|
||||
|
@ -410,7 +410,7 @@ gdk_content_register_deserializer (const char *mime_type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (deserialize != NULL);
|
||||
|
||||
deserializer = g_slice_new0 (Deserializer);
|
||||
deserializer = g_new0 (Deserializer, 1);
|
||||
|
||||
deserializer->mime_type = g_intern_string (mime_type);
|
||||
deserializer->type = type;
|
||||
|
@ -112,7 +112,7 @@ gdk_content_formats_new_take (GType * gtypes,
|
||||
const char **mime_types,
|
||||
gsize n_mime_types)
|
||||
{
|
||||
GdkContentFormats *result = g_slice_new0 (GdkContentFormats);
|
||||
GdkContentFormats *result = g_new0 (GdkContentFormats, 1);
|
||||
result->ref_count = 1;
|
||||
|
||||
result->gtypes = gtypes;
|
||||
@ -287,7 +287,7 @@ gdk_content_formats_unref (GdkContentFormats *formats)
|
||||
|
||||
g_free (formats->gtypes);
|
||||
g_free (formats->mime_types);
|
||||
g_slice_free (GdkContentFormats, formats);
|
||||
g_free (formats);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -611,7 +611,7 @@ gdk_content_formats_builder_new (void)
|
||||
{
|
||||
GdkContentFormatsBuilder *builder;
|
||||
|
||||
builder = g_slice_new0 (GdkContentFormatsBuilder);
|
||||
builder = g_new0 (GdkContentFormatsBuilder, 1);
|
||||
builder->ref_count = 1;
|
||||
|
||||
return builder;
|
||||
@ -665,7 +665,7 @@ gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder)
|
||||
return;
|
||||
|
||||
gdk_content_formats_builder_clear (builder);
|
||||
g_slice_free (GdkContentFormatsBuilder, builder);
|
||||
g_free (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,7 +416,7 @@ gdk_content_register_serializer (GType type,
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (serialize != NULL);
|
||||
|
||||
serializer = g_slice_new0 (Serializer);
|
||||
serializer = g_new0 (Serializer, 1);
|
||||
|
||||
serializer->mime_type = g_intern_string (mime_type);
|
||||
serializer->type = type;
|
||||
|
@ -322,7 +322,7 @@ static void
|
||||
free_pointer_info (GdkPointerSurfaceInfo *info)
|
||||
{
|
||||
g_clear_object (&info->surface_under_pointer);
|
||||
g_slice_free (GdkPointerSurfaceInfo, info);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -834,7 +834,7 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
|
||||
|
||||
if (G_UNLIKELY (!info))
|
||||
{
|
||||
info = g_slice_new0 (GdkPointerSurfaceInfo);
|
||||
info = g_new0 (GdkPointerSurfaceInfo, 1);
|
||||
g_hash_table_insert (display->pointers_info, device, info);
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ static void
|
||||
free_value (gpointer value)
|
||||
{
|
||||
g_value_unset (value);
|
||||
g_slice_free (GValue, value);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -790,7 +790,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, source_tag);
|
||||
value = g_slice_new0 (GValue);
|
||||
value = g_new0 (GValue, 1);
|
||||
g_value_init (value, type);
|
||||
g_task_set_task_data (task, value, free_value);
|
||||
|
||||
|
@ -43,7 +43,7 @@ _gdk_frame_timings_new (gint64 frame_counter)
|
||||
{
|
||||
GdkFrameTimings *timings;
|
||||
|
||||
timings = g_slice_new0 (GdkFrameTimings);
|
||||
timings = g_new0 (GdkFrameTimings, 1);
|
||||
timings->ref_count = 1;
|
||||
timings->frame_counter = frame_counter;
|
||||
|
||||
@ -99,9 +99,7 @@ gdk_frame_timings_unref (GdkFrameTimings *timings)
|
||||
|
||||
timings->ref_count--;
|
||||
if (timings->ref_count == 0)
|
||||
{
|
||||
g_slice_free (GdkFrameTimings, timings);
|
||||
}
|
||||
g_free (timings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ gdk_io_pipe_new (void)
|
||||
{
|
||||
GdkIOPipe *pipe;
|
||||
|
||||
pipe = g_slice_new0 (GdkIOPipe);
|
||||
pipe = g_new0 (GdkIOPipe, 1);
|
||||
pipe->ref_count = 1;
|
||||
|
||||
g_mutex_init (&pipe->mutex);
|
||||
@ -76,7 +76,7 @@ gdk_io_pipe_unref (GdkIOPipe *pipe)
|
||||
g_cond_clear (&pipe->cond);
|
||||
g_mutex_clear (&pipe->mutex);
|
||||
|
||||
g_slice_free (GdkIOPipe, pipe);
|
||||
g_free (pipe);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -67,7 +67,12 @@ G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
|
||||
GdkRGBA *
|
||||
gdk_rgba_copy (const GdkRGBA *rgba)
|
||||
{
|
||||
return g_slice_dup (GdkRGBA, rgba);
|
||||
GdkRGBA *copy;
|
||||
|
||||
copy = g_new (GdkRGBA, 1);
|
||||
memcpy (copy, rgba, sizeof (GdkRGBA));
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +84,7 @@ gdk_rgba_copy (const GdkRGBA *rgba)
|
||||
void
|
||||
gdk_rgba_free (GdkRGBA *rgba)
|
||||
{
|
||||
g_slice_free (GdkRGBA, rgba);
|
||||
g_free (rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ gdk_texture_downloader_new (GdkTexture *texture)
|
||||
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
self = g_slice_new (GdkTextureDownloader);
|
||||
self = g_new (GdkTextureDownloader, 1);
|
||||
gdk_texture_downloader_init (self, texture);
|
||||
|
||||
return self;
|
||||
@ -121,7 +121,7 @@ gdk_texture_downloader_free (GdkTextureDownloader *self)
|
||||
g_return_if_fail (self != NULL);
|
||||
|
||||
gdk_texture_downloader_finish (self);
|
||||
g_slice_free (GdkTextureDownloader, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user