-Property vcard_max_property(VCardVersion version) {
- Property p = VCARD_PROPERTIES;
-
- if (version == VCARD_VERSION_2_1) {
- p = TZ;
- } else if (version == VCARD_VERSION_3_0) {
- p = IMPP;
- } else if (version == VCARD_VERSION_4_0) {
- p = VCARD_PROPERTIES - 1;
- }
-
- return p;
-}
-
-void destroy_hash_table(GHashTable* ht) {
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init (&iter, ht);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- if (value)
- g_slist_free_full((GSList *) value, vcard_property_free);
- }
-
- g_hash_table_destroy(ht);
-}
-
-static void init_g_hash_table(GHashTable** ht, VCardVersion version) {
- if (!ht) return;
-
- Property property = vcard_max_property(version);
- if (property < VCARD_PROPERTIES) {
- *ht = g_hash_table_new_full(
- g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
- for (Property i = N; i <= property; i++) {
- g_hash_table_insert(*ht, g_strdup(Properties[i]), NULL);
- }
- }
-}
-