mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-05 23:48:44 +02:00
gitypelib: Replace multiple constructors with gi_typelib_new_from_bytes()
`GBytes` provides a way of handling const memory blobs, stolen memory blobs, and mapped files. Rather than having `GITypelib` implement all of those itself, just take a `GBytes` as input. This is an API break, but libgirepository hasn’t been in a stable release yet. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3155
This commit is contained in:
@@ -1752,7 +1752,12 @@ require_internal (GIRepository *repository,
|
||||
|
||||
{
|
||||
GError *temp_error = NULL;
|
||||
typelib = gi_typelib_new_from_mapped_file (mfile, &temp_error);
|
||||
GBytes *bytes = NULL;
|
||||
|
||||
bytes = g_mapped_file_get_bytes (mfile);
|
||||
typelib = gi_typelib_new_from_bytes (bytes, &temp_error);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (!typelib)
|
||||
{
|
||||
g_set_error (error, GI_REPOSITORY_ERROR,
|
||||
|
Reference in New Issue
Block a user