File: zhash.h

package info (click to toggle)
libzia 4.36-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,320 kB
  • sloc: ansic: 24,172; sh: 4,408; makefile: 211
file content (56 lines) | stat: -rw-r--r-- 1,641 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
    zhash.h - libzia hash extension
    Copyright (C) 2011-2013 Ladislav Vaiz <ok1zia@nagano.cz>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

*/

#ifndef __GHASH_H
#define __GHASH_H

#include <libziaint.h>
#include <glib.h>

typedef struct _ZHashNode      ZHashNode;
typedef struct _ZHashTable     ZHashTable;

struct _ZHashNode
{
  gpointer key;
  gpointer value;
  ZHashNode *next;
};

struct _ZHashTable
{
  gint size;
  gint nnodes;
  guint frozen;
  ZHashNode **nodes;
  GHashFunc hash_func;
  GCompareFunc key_compare_func;
};

/*void init_ghash(void);
void free_ghash(void);*/
ZHashTable *z_hash_table_new (GHashFunc hash_func, GCompareFunc key_compare_func);
void z_hash_table_destroy (ZHashTable *hash_table);
void z_hash_table_foreach (ZHashTable *hash_table, GHFunc func, gpointer user_data);
void z_hash_table_insert (ZHashTable *hash_table, gpointer key, gpointer value);
void z_hash_table_remove (ZHashTable *hash_table, gconstpointer key);
gpointer z_hash_table_lookup (ZHashTable *hash_table, gconstpointer key);
gboolean z_hash_table_lookup_extended (ZHashTable *hash_table, gconstpointer lookup_key, gpointer *orig_key, gpointer *value);
guint z_hash_table_foreach_remove (ZHashTable *hash_table, GHRFunc func, gpointer user_data);
guint z_hash_table_size (ZHashTable *hash_table);


gboolean free_gpointer_item(gpointer key, gpointer value, gpointer user_data); 

#ifndef Z_HAVE_G_HASH_TABLE_REMOVE_ALL
void g_hash_table_remove_all(GHashTable *hash_table);
#endif

#endif