return entry;
}
+cr_BinaryData *
+cr_binary_data_new(void)
+{
+ return (cr_BinaryData *) g_new0(cr_BinaryData, 1);
+}
+
cr_Package *
cr_package_new(void)
{
g_slist_free (package->changelogs);
}
+ g_free(package->siggpg);
+ g_free(package->sigpgp);
+
g_free (package);
}
char *changelog; /*!< text of changelog */
} cr_ChangelogEntry;
+/** Binary data.
+ */
+typedef struct {
+ void *data;
+ gsize size;
+} cr_BinaryData;
+
/** Package
*/
typedef struct {
GSList *changelogs; /*!< changelogs (list of cr_ChangelogEntry
structs) */
+ char *hdrid;
+ cr_BinaryData *siggpg;
+ cr_BinaryData *sigpgp;
+
GStringChunk *chunk; /*!< string chunk for store all package strings
on the single place */
*/
cr_ChangelogEntry *cr_changelog_entry_new(void);
+/** Create new (empty) structure for binary data
+ * @return new mepty cr_BinaryData
+ */
+cr_BinaryData *cr_binary_data_new(void);
+
/** Create new (empty) package structure.
* @return new empty cr_Package
*/
rpmtdFree(changelognames);
rpmtdFree(changelogtexts);
+
+ //
+ // Keys and hdrid (data used for caching when the --cachedir is specified)
+ //
+
+ pkg->hdrid = cr_safe_string_chunk_insert(pkg->chunk,
+ headerGetString(hdr, RPMTAG_HDRID));
+
+ rpmtd gpgtd = rpmtdNew();
+ rpmtd pgptd = rpmtdNew();
+
+ if (headerGet(hdr, RPMTAG_SIGGPG, gpgtd, flags)) {
+ pkg->siggpg = cr_binary_data_new();
+ pkg->siggpg->size = gpgtd->count;
+ pkg->siggpg->data = g_string_chunk_insert_len(pkg->chunk,
+ gpgtd->data,
+ gpgtd->count);
+ }
+
+ if (headerGet(hdr, RPMTAG_SIGPGP, pgptd, flags)) {
+ pkg->sigpgp = cr_binary_data_new();
+ pkg->sigpgp->size = pgptd->count;
+ pkg->sigpgp->data = g_string_chunk_insert_len(pkg->chunk,
+ pgptd->data,
+ pgptd->count);
+ }
+
+ rpmtdFree(gpgtd);
+ rpmtdFree(pgptd);
+
return pkg;
}