Prefer g_new() over spice_new()

spice_new() should probably be replaced by g_new() in all spice code
that depend on glib.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Marc-André Lureau 2017-08-10 11:30:41 +02:00
parent fdba1a9bc5
commit 01d5942e32
3 changed files with 9 additions and 9 deletions

View File

@ -82,7 +82,7 @@ typedef struct SpiceGstFrame {
static SpiceGstFrame *create_gst_frame(GstBuffer *buffer, SpiceFrame *frame)
{
SpiceGstFrame *gstframe = spice_new(SpiceGstFrame, 1);
SpiceGstFrame *gstframe = g_new(SpiceGstFrame, 1);
gstframe->timestamp = GST_BUFFER_PTS(buffer);
gstframe->frame = frame;
gstframe->sample = NULL;
@ -95,7 +95,7 @@ static void free_gst_frame(SpiceGstFrame *gstframe)
if (gstframe->sample) {
gst_sample_unref(gstframe->sample);
}
free(gstframe);
g_free(gstframe);
}
@ -474,7 +474,7 @@ static void spice_gst_decoder_destroy(VideoDecoder *video_decoder)
}
g_queue_free(decoder->display_queue);
free(decoder);
g_free(decoder);
/* Don't call gst_deinit() as other parts of the client
* may still be using GStreamer.
@ -595,7 +595,7 @@ VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream)
g_return_val_if_fail(VALID_VIDEO_CODEC_TYPE(codec_type), NULL);
if (gstvideo_init()) {
decoder = spice_new0(SpiceGstDecoder, 1);
decoder = g_new0(SpiceGstDecoder, 1);
decoder->base.destroy = spice_gst_decoder_destroy;
decoder->base.reschedule = spice_gst_decoder_reschedule;
decoder->base.queue_frame = spice_gst_decoder_queue_frame;

View File

@ -294,7 +294,7 @@ static void mjpeg_decoder_destroy(VideoDecoder* video_decoder)
g_queue_free(decoder->msgq);
jpeg_destroy_decompress(&decoder->mjpeg_cinfo);
g_free(decoder->out_frame);
free(decoder);
g_free(decoder);
}
G_GNUC_INTERNAL
@ -302,7 +302,7 @@ VideoDecoder* create_mjpeg_decoder(int codec_type, display_stream *stream)
{
g_return_val_if_fail(codec_type == SPICE_VIDEO_CODEC_TYPE_MJPEG, NULL);
MJpegDecoder *decoder = spice_new0(MJpegDecoder, 1);
MJpegDecoder *decoder = g_new0(MJpegDecoder, 1);
decoder->base.destroy = mjpeg_decoder_destroy;
decoder->base.reschedule = mjpeg_decoder_reschedule;
@ -322,7 +322,7 @@ VideoDecoder* create_mjpeg_decoder(int codec_type, display_stream *stream)
decoder->mjpeg_src.term_source = mjpeg_src_term;
decoder->mjpeg_cinfo.src = &decoder->mjpeg_src;
/* All the other fields are initialized to zero by spice_new0(). */
/* All the other fields are initialized to zero by g_new0(). */
return (VideoDecoder*)decoder;
}

View File

@ -1511,14 +1511,14 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
* decoding and best decide if/when to drop them when they are late,
* taking into account the impact on later frames.
*/
frame = spice_new(SpiceFrame, 1);
frame = g_new(SpiceFrame, 1);
frame->mm_time = op->multi_media_time;
frame->dest = *stream_get_dest(st, in);
frame->size = spice_msg_in_frame_data(in, &frame->data);
frame->data_opaque = in;
frame->ref_data = (void*)spice_msg_in_ref;
frame->unref_data = (void*)spice_msg_in_unref;
frame->free = (void*)free;
frame->free = (void*)g_free;
if (!st->video_decoder->queue_frame(st->video_decoder, frame, latency)) {
destroy_stream(channel, op->id);
report_invalid_stream(channel, op->id);