1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
4 *
5 * This library is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif /* HAVE_CONFIG_H */
23
24 #include "glib-compatible.h"
25
26 #if !GLIB_CHECK_VERSION(2, 14, 0)
27 static void
collect_hash_key(gpointer key,gpointer value,gpointer user_data)28 collect_hash_key (gpointer key, gpointer value, gpointer user_data)
29 {
30 GList **keys = user_data;
31
32 *keys = g_list_append(*keys, key);
33 }
34
35 GList *
gcompatible_hash_table_get_keys(GHashTable * hash_table)36 gcompatible_hash_table_get_keys (GHashTable *hash_table)
37 {
38 GList *keys = NULL;
39
40 g_hash_table_foreach(hash_table, collect_hash_key, &keys);
41 return keys;
42 }
43 #endif
44
45 /*
46 vi:ts=4:nowrap:ai:expandtab:sw=4
47 */
48