void mobi_free_opf_metadata(OPFmetadata *metadata) {
    if (metadata) {
        /* <meta/> */
        mobi_free_opf_struct_2el(metadata->meta, name, content);
        /* <dc-metadata/> */
        mobi_free_opf_struct_3el(metadata->dc_meta->contributor, value, file_as, role);
        mobi_free_opf_struct_3el(metadata->dc_meta->creator, value, file_as, role);
        mobi_free_opf_struct_3el(metadata->dc_meta->identifier, value, id, scheme);
        mobi_free_opf_struct_2el(metadata->dc_meta->subject, value, basic_code);
        mobi_free_opf_struct_2el(metadata->dc_meta->date, value, event);
        mobi_free_opf_array(metadata->dc_meta->description);
        mobi_free_opf_array(metadata->dc_meta->language);
        mobi_free_opf_array(metadata->dc_meta->publisher);
        mobi_free_opf_array(metadata->dc_meta->rights);
        mobi_free_opf_array(metadata->dc_meta->source);
        mobi_free_opf_array(metadata->dc_meta->title);
        mobi_free_opf_array(metadata->dc_meta->type);
        free(metadata->dc_meta);
        /* <x-metadata/> */
        mobi_free_opf_struct_2el(metadata->x_meta->srp, value, currency);
        mobi_free_opf_array(metadata->x_meta->adult);
        mobi_free_opf_array(metadata->x_meta->default_lookup_index);
        mobi_free_opf_array(metadata->x_meta->dict_short_name);
        mobi_free_opf_array(metadata->x_meta->dictionary_in_lang);
        mobi_free_opf_array(metadata->x_meta->dictionary_out_lang);
        mobi_free_opf_array(metadata->x_meta->embedded_cover);
        mobi_free_opf_array(metadata->x_meta->imprint);
        mobi_free_opf_array(metadata->x_meta->review);
        free(metadata->x_meta);
        free(metadata);
    }
}
void mobi_free_opf_metadata(OPFmetadata *metadata) {
    if (metadata) {
         
        mobi_free_opf_struct_2el(metadata->meta, name, content);
         
        mobi_free_opf_struct_3el(metadata->dc_meta->contributor, value, file_as, role);
        mobi_free_opf_struct_3el(metadata->dc_meta->creator, value, file_as, role);
        mobi_free_opf_struct_3el(metadata->dc_meta->identifier, value, id, scheme);
        mobi_free_opf_struct_2el(metadata->dc_meta->subject, value, basic_code);
        mobi_free_opf_struct_2el(metadata->dc_meta->date, value, event);
        mobi_free_opf_array(metadata->dc_meta->description);
        mobi_free_opf_array(metadata->dc_meta->language);
        mobi_free_opf_array(metadata->dc_meta->publisher);
        mobi_free_opf_array(metadata->dc_meta->rights);
        mobi_free_opf_array(metadata->dc_meta->source);
        mobi_free_opf_array(metadata->dc_meta->title);
        mobi_free_opf_array(metadata->dc_meta->type);
        free(metadata->dc_meta);
         
        mobi_free_opf_struct_2el(metadata->x_meta->srp, value, currency);
        mobi_free_opf_array(metadata->x_meta->adult);
        mobi_free_opf_array(metadata->x_meta->default_lookup_index);
        mobi_free_opf_array(metadata->x_meta->dict_short_name);
        mobi_free_opf_array(metadata->x_meta->dictionary_in_lang);
        mobi_free_opf_array(metadata->x_meta->dictionary_out_lang);
        mobi_free_opf_array(metadata->x_meta->embedded_cover);
        mobi_free_opf_array(metadata->x_meta->imprint);
        mobi_free_opf_array(metadata->x_meta->review);
        free(metadata->x_meta);
        free(metadata);
    }
}