[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:
Johan Dahlin
2010-05-20 11:33:49 -03:00
parent cc270b03d6
commit 7e2e379388
4 changed files with 13 additions and 13 deletions

View File

@@ -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);
}