Use g_memdup2() where available and add fallback for older GLib versions

Size is constant here, so no problem in any case, but g_memdup() is
now deprecated and we don't want deprecation warnings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/257>
This commit is contained in:
Tim-Philipp Müller 2021-05-22 18:41:08 +01:00 committed by GStreamer Marge Bot
parent 16ef2917e2
commit e7cc4b02d5
2 changed files with 5 additions and 1 deletions

View file

@ -476,7 +476,7 @@ make_source (GESFormatter * self, GList * reflist, GHashTable * source_table)
layer = ges_layer_new ();
g_object_set (layer, "auto-transition", TRUE, "priority", prio, NULL);
ges_timeline_add_layer (self->timeline, layer);
g_hash_table_insert (priv->layers_table, g_memdup (&prio,
g_hash_table_insert (priv->layers_table, g_memdup2 (&prio,
sizeof (guint64)), layer);
}

View file

@ -322,6 +322,10 @@ if gst_version_nano == 0
endif
endif
if gio_dep.version().version_compare('< 2.67.4')
cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)')
endif
configure_file(output: 'config.h', configuration: cdata)
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')