/[rdesktop]/sourceforge.net/trunk/seamlessrdp/ClientDLL/hash.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/seamlessrdp/ClientDLL/hash.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 930 by astrand, Thu Jun 30 14:14:56 2005 UTC revision 933 by astrand, Thu Jun 30 14:46:14 2005 UTC
# Line 10  Line 10 
10  ** if there was one.  ** if there was one.
11  */  */
12    
13  typedef struct bucket {  typedef struct bucket
14        char *key;  {
15        void *data;      char *key;
16        struct bucket *next;      void *data;
17        struct bucket *next;
18  } bucket;  } bucket;
19    
20  /*  /*
# Line 25  typedef struct bucket { Line 26  typedef struct bucket {
26  ** times as many nodes have been inserted as the table was created with.  ** times as many nodes have been inserted as the table was created with.
27  */  */
28    
29  typedef struct hash_table {  typedef struct hash_table
30        size_t size;  {
31        size_t count;     /* HW */      size_t size;
32        bucket **table;      size_t count;               /* HW */
33        bucket **table;
34  } hash_table;  } hash_table;
35    
36  /*  /*
# Line 36  typedef struct hash_table { Line 38  typedef struct hash_table {
38  ** the table's size to 0, and the pointer to the table to NULL.  ** the table's size to 0, and the pointer to the table to NULL.
39  */  */
40  /* HW: returns NULL if it fails */  /* HW: returns NULL if it fails */
41  hash_table *hash_construct_table(hash_table *table,size_t size);  hash_table *hash_construct_table(hash_table * table, size_t size);
42    
43  /*  /*
44  ** Inserts a pointer to 'data' in the table, with a copy of 'key' as its  ** Inserts a pointer to 'data' in the table, with a copy of 'key' as its
# Line 44  hash_table *hash_construct_table(hash_ta Line 46  hash_table *hash_construct_table(hash_ta
46  ** associated data.  ** associated data.
47  */  */
48    
49  void *hash_insert(char *key,void *data,struct hash_table *table);  void *hash_insert(char *key, void *data, struct hash_table *table);
50    
51  /*  /*
52  ** Returns a pointer to the data associated with a key.  If the key has  ** Returns a pointer to the data associated with a key.  If the key has
53  ** not been inserted in the table, returns NULL.  ** not been inserted in the table, returns NULL.
54  */  */
55    
56  void *hash_lookup(char *key,struct hash_table *table);  void *hash_lookup(char *key, struct hash_table *table);
57    
58  /*  /*
59  ** Deletes an entry from the table.  Returns a pointer to the data that  ** Deletes an entry from the table.  Returns a pointer to the data that
# Line 59  void *hash_lookup(char *key,struct hash_ Line 61  void *hash_lookup(char *key,struct hash_
61  ** properly.  ** properly.
62  */  */
63    
64  void *hash_del(char *key,struct hash_table *table);  void *hash_del(char *key, struct hash_table *table);
65    
66  /*  /*
67  ** Goes through a hash table and calls the function passed to it  ** Goes through a hash table and calls the function passed to it
# Line 68  void *hash_del(char *key,struct hash_tab Line 70  void *hash_del(char *key,struct hash_tab
70  ** with it.  ** with it.
71  */  */
72    
73  void hash_enumerate( hash_table *table,void (*func)(char *,void *));  void hash_enumerate(hash_table * table, void (*func) (char *, void *));
74    
75  /* HW: same as above, but sorted output ( sorted on 'key') */  /* HW: same as above, but sorted output ( sorted on 'key') */
76  int hash_sorted_enum( hash_table *table, void(*func)(char *, void*));  int hash_sorted_enum(hash_table * table, void (*func) (char *, void *));
77    
78  /*  /*
79  ** Frees a hash table.  For each node that was inserted in the table,  ** Frees a hash table.  For each node that was inserted in the table,
# Line 85  int hash_sorted_enum( hash_table *table, Line 87  int hash_sorted_enum( hash_table *table,
87  ** any function with the data. )  ** any function with the data. )
88  */  */
89    
90  void hash_free_table(hash_table *table, void (*func)(void *));  void hash_free_table(hash_table * table, void (*func) (void *));
91    
92  #endif /* HASH__H */  #endif /* HASH__H */

Legend:
Removed from v.930  
changed lines
  Added in v.933

  ViewVC Help
Powered by ViewVC 1.1.26