libpriv/rpm-util: add autoptr support to RpmHeaders

Prep for follow up patches.

Closes: #1200
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-01-11 18:35:40 +00:00 committed by Atomic Bot
parent 542e4c153b
commit 9f7511a5d8
2 changed files with 14 additions and 6 deletions

View File

@ -320,14 +320,17 @@ rpmhdrs_new (RpmOstreeRefTs *refts, const GPtrArray *patterns)
return ret;
}
static void
rpmhdrs_free (struct RpmHeaders *l1)
void
rpmhdrs_free (struct RpmHeaders *hdrs)
{
g_ptr_array_free (l1->hs, TRUE);
l1->hs = NULL;
rpmostree_refts_unref (l1->refts);
if (!hdrs)
return;
g_free (l1);
g_ptr_array_free (hdrs->hs, TRUE);
hdrs->hs = NULL;
rpmostree_refts_unref (hdrs->refts);
g_free (hdrs);
}
static struct RpmHeadersDiff *

View File

@ -38,6 +38,8 @@ struct RpmHeaders
GPtrArray *hs; /* list of rpm header objects from <rpm.h> = Header */
};
typedef struct RpmHeaders RpmHeaders;
struct RpmHeadersDiff
{
GPtrArray *hs_add; /* list of rpm header objects from <rpm.h> = Header */
@ -91,6 +93,9 @@ const char *rpmrev_get_commit (struct RpmRevisionData *self);
void rpmrev_free (struct RpmRevisionData *ptr);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(RpmRevisionData, rpmrev_free);
void rpmhdrs_free (RpmHeaders *hdrs);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(RpmHeaders, rpmhdrs_free);
RpmOstreeRefSack *
rpmostree_get_refsack_for_commit (OstreeRepo *repo,
const char *ref,