Use new text accessors.
[geda-gaf/berndj.git] / libgeda / tests / hashpop.c
blobb5e518bef2e6ead5f92483ab0493acfbaed400b2
1 #include "config.h"
3 #include <glib.h>
4 #include <libguile.h>
5 #include <stdio.h>
6 #include "defines.h"
7 #include "struct.h"
8 #include "prototype.h"
10 void hashprinter(gpointer key, gpointer value, gpointer user_data)
12 printf("key=%s, value=%s\n", (char *) key, (char *) value);
15 int main(int argc, char *argv[])
17 char *pairs = "foo=bar,test=hashpop,answer=42";
18 GHashTable *tab;
20 if (argc > 1) {
21 pairs = argv[1];
24 tab = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free);
26 /* u_basic_populate_hash() needs to modify its string argument. */
27 pairs = g_strdup(pairs);
29 u_basic_populate_hash(tab, pairs, ',', '=');
30 g_hash_table_foreach(tab, &hashprinter, NULL);
32 g_free(pairs);
34 return 0;