File: glib_util.c

package info (click to toggle)
tagtool 0.12.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,352 kB
  • ctags: 1,010
  • sloc: ansic: 9,013; sh: 3,571; makefile: 121
file content (21 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdlib.h>

#include "glib_util.h"


static void table_free_entry(gpointer key, gpointer value, gpointer data)
{
	int flags = (int)data;
	if (flags & 1)
		free(key);
	if (flags & 2)
		free(value);
}


void g_hash_table_free(GHashTable *hash_table, gboolean free_keys, gboolean free_values)
{
	g_hash_table_foreach(hash_table, table_free_entry, (gpointer)(free_keys | free_values<<1));
	g_hash_table_destroy(hash_table);
}