Created
November 11, 2010 06:56
-
-
Save bert/672129 to your computer and use it in GitHub Desktop.
Dump a hash table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
hash_table_dump (GHashTable * hash_table) | |
{ | |
GHashTableIter iter; | |
gpointer key; | |
gpointer value; | |
g_hash_table_iter_init (hash_table, &iter); | |
while (g_hash_table_iter_next (&iter, &key, &value)) | |
{ | |
g_print ("key: %s, value: %s", (const char *) key, (const char *) value); | |
} | |
return (EXIT_SUCCESS); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void | |
hash_table_dump_pair | |
( | |
const char *key, | |
const char *value | |
) | |
{ | |
g_print ("Key: %s Value: %s\n", key, value); | |
} | |
... | |
g_hash_table_foreach (hash_table, (GHFunc) hash_table_dump_pair, NULL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment