void *cbdata,
GError **err);
-/** Default callback for the new package.
- */
-int cr_newpkgcb(cr_Package **pkg,
- const char *pkgId,
- const char *name,
- const char *arch,
- void *cbdata,
- GError **err);
-
/** Parse filelists.xml. File could be compressed.
* @param path Path to filelists.xml (plain or compressed)
* @param newpkgcb Callback for new package (Called when new package
else
g_set_error(&pd->err, CR_XML_PARSER_FIL_ERROR, CRE_CBINTERRUPTED,
"Parsing interrupted");
+ } else {
+ // If callback return CRE_OK but it simultaneously set
+ // the tmp_err then it's a programming error.
+ assert(tmp_err == NULL);
}
if (pd->pkg) {
assert(!messages || *messages == NULL);
assert(!err || *err == NULL);
- if (!newpkgcb)
+ if (!newpkgcb) // Use default newpkgcb
newpkgcb = cr_newpkgcb;
f = cr_open(path, CR_CW_MODE_READ, CR_CW_AUTO_DETECT_COMPRESSION);
#define XML_BUFFER_SIZE 8192
#define CONTENT_REALLOC_STEP 256
+/* File types in filelists.xml */
typedef enum {
FILE_FILE,
FILE_DIR,
int last_file_type;
} cr_ParserData;
+/** Malloc and initialize common part of XML parser data.
+ */
cr_ParserData *cr_xml_parser_data();
+/** Frees XML parser data.
+ */
char *cr_xml_parser_data_free(cr_ParserData *pd);
+/** Find attribute in list of attributes.
+ * @param name Attribute name.
+ * @param attr List of attributes of the tag
+ * @return Value or NULL
+ */
static inline const char *
cr_find_attr(const char *name, const char **attr)
{
return NULL;
}
+/** XML character handler
+ */
void XMLCALL cr_char_handler(void *pdata, const XML_Char *s, int len);
+/** Default callback for the new package.
+ */
+int cr_newpkgcb(cr_Package **pkg,
+ const char *pkgId,
+ const char *name,
+ const char *arch,
+ void *cbdata,
+ GError **err);
+
#ifdef __cplusplus
}
#endif