]> git.datanom.net - vcard-parser.git/blobdiff - src/vcard-parser.c
New function
[vcard-parser.git] / src / vcard-parser.c
index e35dba85f9cdc4075c20da5b736f1aee81b895ba..a62d8d34d6c043c552970c03c6fe5484d845c57c 100644 (file)
@@ -175,46 +175,6 @@ static gchar** vcard_text_normalize(const gchar** text) {
        return new;
 }
 
-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);
-               }
-       }
-}
-
 static VCardParserResponse vcard_parse(gchar** text, VCardVersion version, GHashTable** vcard) {
        VCardParserResponse r = VCARD_PARSER_ERROR;
        guint l = g_strv_length(text);
@@ -264,6 +224,46 @@ static VCardParserResponse vcard_parse(gchar** text, VCardVersion version, GHash
        return r;
 }
 
+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);
+}
+
+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);
+               }
+       }
+}
+
 VCardVersion str_2_vcard_version(const gchar* version) {
        VCardVersion vv = VCARD_VERSION_DETECT;
 
This page took 0.03172 seconds and 5 git commands to generate.