mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-06 07:58:44 +02:00
[girepository] Use g_slice
Use g_slice to allocate instead of g_new(x, 1); It uses a memory pool internally and should be faster, especially for GBaseInfo/GRealInfo, structs which are tiny.
This commit is contained in:
@@ -1043,7 +1043,7 @@ free_candidate (struct NamespaceVersionCandidadate *candidate)
|
||||
g_mapped_file_unref (candidate->mfile);
|
||||
g_free (candidate->path);
|
||||
g_free (candidate->version);
|
||||
g_free (candidate);
|
||||
g_slice_free (struct NamespaceVersionCandidadate, candidate);
|
||||
}
|
||||
|
||||
static GMappedFile *
|
||||
@@ -1111,7 +1111,7 @@ find_namespace_latest (const gchar *namespace,
|
||||
g_clear_error (&error);
|
||||
continue;
|
||||
}
|
||||
candidate = g_new0 (struct NamespaceVersionCandidadate, 1);
|
||||
candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
|
||||
candidate->mfile = mfile;
|
||||
candidate->path_index = index;
|
||||
candidate->path = path;
|
||||
@@ -1134,7 +1134,7 @@ find_namespace_latest (const gchar *namespace,
|
||||
result = elected->mfile;
|
||||
*path_ret = elected->path;
|
||||
*version_ret = elected->version;
|
||||
g_free (elected); /* just free the container */
|
||||
g_slice_free (struct NamespaceVersionCandidadate, elected); /* just free the container */
|
||||
g_slist_foreach (candidates, (GFunc) free_candidate, NULL);
|
||||
g_slist_free (candidates);
|
||||
}
|
||||
|
Reference in New Issue
Block a user