1\section{adt ghash\+: Generic hash tables.}
2\label{group__adt__ghash}\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
3\subsection*{Data Structures}
4\begin{DoxyCompactItemize}
5\item
6struct \hyperlink{structghash}{ghash}
7\item
8struct \hyperlink{structghashiter}{ghashiter}
9\end{DoxyCompactItemize}
10\subsection*{Macros}
11\begin{DoxyCompactItemize}
12\item
13\#define \hyperlink{group__adt__ghash_ga06408a9495c3264536eb441f2cfe21f0}{ghash\+\_\+entry\+\_\+hash}(P)~($\ast$(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t}$\ast$)(P))
14\item
15\#define \hyperlink{group__adt__ghash_ga3f6b74b60133f8479a5351213ad097e9}{ghash\+\_\+entry\+\_\+keyptr}(P)~((P)+sizeof(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t}))
16\item
17\#define \hyperlink{group__adt__ghash_gab20f65db478dd9d049cf30b5c0e46798}{ghash\+\_\+entry\+\_\+dataptr}(P,  L)~((P)+sizeof(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t})+(L))
18\item
19\#define \hyperlink{group__adt__ghash_ga1cf13ef03b3c316a344d5a7f5af2ef9f}{ghash\+\_\+hashb}~\hyperlink{group__adt_gad9ce9e50c1be3b099d94315960807237}{adt\+\_\+hashb}
20\item
21\#define \hyperlink{group__adt__ghash_gaa793802d1ccac89ba8f2450041b19510}{ghash\+\_\+hashs}~\hyperlink{group__adt_ga9b98c9ab4f62ccca61ad6903a0ebd798}{adt\+\_\+hashs}
22\item
23\#define \hyperlink{group__adt__ghash_ga67d80747f0e39bdaaaa34c1a3efa45b9}{ghash\+\_\+hashsp}~\hyperlink{group__adt_ga7e68b73378693c9b0945a11f849f3063}{adt\+\_\+hashsp}
24\item
25\#define \hyperlink{group__adt__ghash_gada65697b1f72b4e162981b6e5ac590e8}{G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE)
26\item
27\#define \hyperlink{group__adt__ghash_ga4275ace9d4a3af4cac0ffb37cfb0285a}{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET}(P\+R\+E\+F\+IX)~((unsigned long)\&((struct P\+R\+E\+F\+IX\#\#\+\_\+entry$\ast$)0)-\/$>$key)
28\item
29\#define \hyperlink{group__adt__ghash_gad9dcfdb435e30e32b276f8ba0cc04b0a}{G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET}(P\+R\+E\+F\+IX)~((unsigned long)\&((struct P\+R\+E\+F\+IX\#\#\+\_\+entry$\ast$)0)-\/$>$data)
30\item
31\#define \hyperlink{group__adt__ghash_ga3464d7a289b27e168f574b1d8f8a8be3}{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE}(P\+R\+E\+F\+IX)
32\item
33\#define \hyperlink{group__adt__ghash_gac1e305054793738b716c40999cfea9bf}{G\+H\+A\+S\+H\+\_\+\+D\+E\+CL}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE)
34\item
35\#define \hyperlink{group__adt__ghash_ga46a99956ed09905f7f8c32c603347bd3}{G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE,  H\+A\+S\+H\+FN,  C\+MP,  K\+C\+O\+PY,  D\+C\+O\+PY,  K\+F\+R\+EE,  D\+F\+R\+EE)
36\item
37\#define \hyperlink{group__adt__ghash_gaf8c5a4c9b22f8c620ed8875de9545f3e}{G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX)
38\item
39\#define \hyperlink{group__adt__ghash_ga928454c59f629fbab0bb20e0fec7033c}{G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE)
40\item
41\#define \hyperlink{group__adt__ghash_ga5c819bab0cc126b53ffe8b7c6e38bb27}{G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE)
42\item
43\#define \hyperlink{group__adt__ghash_gaabe08d7de7829f19e51789b06b1a95da}{G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE)
44\item
45\#define \hyperlink{group__adt__ghash_ga5462bc3c7d1eea455b6733ce60bd39d5}{G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX)
46\item
47\#define \hyperlink{group__adt__ghash_ga2293adaa2df56053b058ff937e7c7254}{G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX)
48\item
49\#define \hyperlink{group__adt__ghash_ga4de5f1ce7dc082245c22f16635a9f5c5}{G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE)
50\item
51\#define \hyperlink{group__adt__ghash_ga28d6134ab05a63015feb36a32ebc6b0f}{G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX)
52\item
53\#define \hyperlink{group__adt__ghash_gae84cc453db9361a299216c9211abc968}{G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX)
54\item
55\#define \hyperlink{group__adt__ghash_ga7d55343d7fd6bd32f4f1107be14f219a}{G\+H\+A\+S\+H\+\_\+\+D\+E\+FN}(P\+R\+E\+F\+IX,  K\+T\+Y\+PE,  D\+T\+Y\+PE,  H\+A\+S\+H\+FN,  C\+M\+P\+FN,  K\+C\+O\+PY,  D\+C\+O\+PY,  K\+F\+R\+EE,  D\+F\+R\+EE)
56\item
57\#define \hyperlink{group__adt__ghash_ga7db779509845eb235a86abc751e44887}{ghashiter\+\_\+loop}(I,  G)~for(\hyperlink{group__adt__ghash_ga3c21bcee8850adc76bee68ee8dd7df3e}{ghashiter\+\_\+first}(I,G);\hyperlink{group__adt__ghash_ga03c8f3d628d6ea8c54ecffe4e892178f}{ghashiter\+\_\+valid}(I);\hyperlink{group__adt__ghash_ga733a92b13ce772e7e3810ea65fcd6454}{ghashiter\+\_\+next}(I))
58\end{DoxyCompactItemize}
59\subsection*{Functions}
60\begin{DoxyCompactItemize}
61\item
62void \hyperlink{group__adt__ghash_gae774815d548201157ed715de43e3ea9d}{ghash\+\_\+insert} (struct \hyperlink{structghash}{ghash} $\ast$d, void $\ast$e)
63\item
64void $\ast$ \hyperlink{group__adt__ghash_ga6550c0dfe54e19112959dba7b164058a}{ghash\+\_\+add} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key, const void $\ast$data)
65\item
66void $\ast$ \hyperlink{group__adt__ghash_ga199afecbf45d644c8371b612141df54b}{ghash\+\_\+set} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key, const void $\ast$data)
67\item
68void \hyperlink{group__adt__ghash_gae609d6df48e1e10a1391d1c94c1dc9ac}{ghash\+\_\+free} (struct \hyperlink{structghash}{ghash} $\ast$d)
69\item
70void $\ast$$\ast$ \hyperlink{group__adt__ghash_ga92c681d50d718324d18ea35118593e0b}{ghash\+\_\+find} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key)
71\item
72void $\ast$ \hyperlink{group__adt__ghash_ga4b02b70d7c67a779a9dca5aa23b7f0f4}{ghash\+\_\+get} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key)
73\item
74void \hyperlink{group__adt__ghash_ga5b2766288f28271bbcf0c45f17e82b89}{ghash\+\_\+init} (struct \hyperlink{structghash}{ghash} $\ast$d, unsigned long keysize, unsigned long entrysize, \hyperlink{group__adt_gad6ce53fbc11dbf67ca1c126cd17ee81a}{adt\+\_\+hash\+\_\+fn} $\ast$hashfn, \hyperlink{group__adt_ga03ed35b7331128b069dc77ab33798782}{adt\+\_\+cmp\+\_\+fn} $\ast$keycmp, \hyperlink{group__adt_gaa98f7f3499407a5dc1afdcbb20df2e15}{adt\+\_\+copy\+\_\+fn} $\ast$keycopy, \hyperlink{group__adt_gaa98f7f3499407a5dc1afdcbb20df2e15}{adt\+\_\+copy\+\_\+fn} $\ast$datacopy, \hyperlink{group__adt_ga87ba7ca9dce36c22fe75a730a1d768a9}{adt\+\_\+free\+\_\+fn} $\ast$keyfree, \hyperlink{group__adt_ga87ba7ca9dce36c22fe75a730a1d768a9}{adt\+\_\+free\+\_\+fn} $\ast$datafree)
75\item
76int \hyperlink{group__adt__ghash_ga6a6bba38a9aaf20a6b10eeaabaa9b869}{ghash\+\_\+rebuild} (struct \hyperlink{structghash}{ghash} $\ast$d)
77\item
78int \hyperlink{group__adt__ghash_ga4beb7c3192aa1ee02a8bf0142758e1af}{ghash\+\_\+rehash} (struct \hyperlink{structghash}{ghash} $\ast$d)
79\item
80int \hyperlink{group__adt__ghash_gaad78f59b6f21c62f96285d1583e017fb}{ghash\+\_\+remove} (struct \hyperlink{structghash}{ghash} $\ast$d, const void $\ast$key)
81\item
82void \hyperlink{group__adt__ghash_ga4778a040ba311b5925ca15d7ca640bf9}{ghash\+\_\+foreach} (struct \hyperlink{structghash}{ghash} $\ast$d, void($\ast$fn)(void $\ast$entry))
83\item
84void $\ast$ \hyperlink{group__adt__ghash_ga0065ab7531db704c0e51250c519693cc}{ghash\+\_\+search} (struct \hyperlink{structghash}{ghash} $\ast$d, int($\ast$fn)(const void $\ast$entry))
85\item
86void \hyperlink{group__adt__ghash_ga3c21bcee8850adc76bee68ee8dd7df3e}{ghashiter\+\_\+first} (struct \hyperlink{structghashiter}{ghashiter} $\ast$, const struct \hyperlink{structghash}{ghash} $\ast$)
87\item
88int \hyperlink{group__adt__ghash_ga03c8f3d628d6ea8c54ecffe4e892178f}{ghashiter\+\_\+valid} (const struct \hyperlink{structghashiter}{ghashiter} $\ast$)
89\item
90void \hyperlink{group__adt__ghash_ga733a92b13ce772e7e3810ea65fcd6454}{ghashiter\+\_\+next} (struct \hyperlink{structghashiter}{ghashiter} $\ast$)
91\end{DoxyCompactItemize}
92
93
94\subsection{Detailed Description}
95The actual hash table manipulation functions use a simple linear probing algorithm with a dynamic table size. Since many more slots are allocated than are in use at any given time, there are always plenty of empty slots available to make searches short. Since each shot is a single pointer, these extra slots don\textquotesingle{}t consume a significant amount of memory.
96
97The structure at the center of the {\ttfamily ghash} implementation contains pointers to the actual data (including all relevant metadata) plus function pointers to the functions needed to manipulate the data.
98
99\subsection{Macro Definition Documentation}
100\mbox{\label{group__adt__ghash_ga928454c59f629fbab0bb20e0fec7033c}}
101\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN}}
102\index{G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
103\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN}{GHASH\_ADD\_DEFN}}
104{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+A\+D\+D\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE }\end{DoxyParamCaption})}
105
106{\bfseries Value\+:}
107\begin{DoxyCode}
108\textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_add(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
109                                    KTYPE \textcolor{keyword}{const}* key, DTYPE \textcolor{keyword}{const}* data) \{ \(\backslash\)
110  return ghash_add(d, key, data); \(\backslash\)
111\}
112\end{DoxyCode}
113Define a specialized {\ttfamily ghash} table add function. \mbox{\label{group__adt__ghash_gad9dcfdb435e30e32b276f8ba0cc04b0a}}
114\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET@{G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET}}
115\index{G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET@{G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
116\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET}{GHASH\_DATAOFFSET}}
117{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+D\+A\+T\+A\+O\+F\+F\+S\+ET(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})~((unsigned long)\&((struct P\+R\+E\+F\+IX\#\#\+\_\+entry$\ast$)0)-\/$>$data)}
118
119The offset of the data into a specialized {\ttfamily ghash} entry. \mbox{\label{group__adt__ghash_gac1e305054793738b716c40999cfea9bf}}
120\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+D\+E\+CL@{G\+H\+A\+S\+H\+\_\+\+D\+E\+CL}}
121\index{G\+H\+A\+S\+H\+\_\+\+D\+E\+CL@{G\+H\+A\+S\+H\+\_\+\+D\+E\+CL}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
122\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+D\+E\+CL}{GHASH\_DECL}}
123{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+D\+E\+CL(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE }\end{DoxyParamCaption})}
124
125{\bfseries Value\+:}
126\begin{DoxyCode}
127GHASH_STRUCT_ENTRY(PREFIX,KTYPE,DTYPE); \(\backslash\)
128extern \textcolor{keywordtype}{void} PREFIX##\_init(\textcolor{keyword}{struct} ghash* d); \(\backslash\)
129extern \textcolor{keywordtype}{void} PREFIX##\_free(\textcolor{keyword}{struct} ghash* d); \(\backslash\)
130extern \textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_add(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
131                                           KTYPE \textcolor{keyword}{const}* key, \(\backslash\)
132                                           DTYPE \textcolor{keyword}{const}* data); \(\backslash\)
133extern \textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_set(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
134                                           KTYPE \textcolor{keyword}{const}* key, \(\backslash\)
135                                           DTYPE \textcolor{keyword}{const}* data); \(\backslash\)
136extern \textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_get(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
137                                           KTYPE \textcolor{keyword}{const}* key); \(\backslash\)
138extern \textcolor{keywordtype}{int} PREFIX##\_rebuild(\textcolor{keyword}{struct} ghash* d); \(\backslash\)
139extern \textcolor{keywordtype}{int} PREFIX##\_rehash(\textcolor{keyword}{struct} ghash* d); \(\backslash\)
140extern \textcolor{keywordtype}{int} PREFIX##\_remove(\textcolor{keyword}{struct} ghash* d, KTYPE \textcolor{keyword}{const}* key); \(\backslash\)
141extern \textcolor{keywordtype}{void} PREFIX##\_foreach(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
142                             \textcolor{keywordtype}{void} (*fn)(\textcolor{keyword}{struct} PREFIX##\_entry*)); \(\backslash\)
143extern \textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_search(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
144                                              \textcolor{keywordtype}{int} (*fn)(\textcolor{keyword}{const} \textcolor{keyword}{struct} PREFIX##\_entry*));
145\end{DoxyCode}
146Declare all the prototypes for a {\ttfamily ghash} table, specialized to particular key and data types. \begin{Desc}
147\item[Examples\+: ]\par
148\hyperlink{adt_2ghash_test_8c-example}{adt/ghash\+\_\+test.\+c}.\end{Desc}
149\mbox{\label{group__adt__ghash_ga7d55343d7fd6bd32f4f1107be14f219a}}
150\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+D\+E\+FN}}
151\index{G\+H\+A\+S\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
152\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+D\+E\+FN}{GHASH\_DEFN}}
153{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE,  }\item[{}]{H\+A\+S\+H\+FN,  }\item[{}]{C\+M\+P\+FN,  }\item[{}]{K\+C\+O\+PY,  }\item[{}]{D\+C\+O\+PY,  }\item[{}]{K\+F\+R\+EE,  }\item[{}]{D\+F\+R\+EE }\end{DoxyParamCaption})}
154
155{\bfseries Value\+:}
156\begin{DoxyCode}
157GHASH_INIT_DEFN(PREFIX,KTYPE,DTYPE,HASHFN,CMPFN,KCOPY,DCOPY,KFREE,DFREE) \(\backslash\)
158GHASH\_FREE\_DEFN(PREFIX) \(\backslash\)
159GHASH\_ADD\_DEFN(PREFIX,KTYPE,DTYPE) \(\backslash\)
160GHASH\_SET\_DEFN(PREFIX,KTYPE,DTYPE) \(\backslash\)
161GHASH\_GET\_DEFN(PREFIX,KTYPE) \(\backslash\)
162GHASH\_REBUILD\_DEFN(PREFIX) \(\backslash\)
163GHASH\_REHASH\_DEFN(PREFIX) \(\backslash\)
164GHASH\_REMOVE\_DEFN(PREFIX,KTYPE) \(\backslash\)
165GHASH\_FOREACH\_DEFN(PREFIX) \(\backslash\)
166GHASH\_SEARCH\_DEFN(PREFIX)
167\end{DoxyCode}
168Define all necessary functions for a specialized {\ttfamily ghash} table. If either of the copy functions {\ttfamily K\+C\+O\+PY} or {\ttfamily D\+C\+O\+PY} are {\ttfamily N\+U\+LL}, a simple memcpy is used instead. If either of the free functions {\ttfamily K\+F\+R\+EE} or {\ttfamily D\+F\+R\+EE} are N\+U\+LL, no data freeing is attempted. \begin{Desc}
169\item[Examples\+: ]\par
170\hyperlink{adt_2ghash_test_8c-example}{adt/ghash\+\_\+test.\+c}.\end{Desc}
171\mbox{\label{group__adt__ghash_gab20f65db478dd9d049cf30b5c0e46798}}
172\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+entry\+\_\+dataptr@{ghash\+\_\+entry\+\_\+dataptr}}
173\index{ghash\+\_\+entry\+\_\+dataptr@{ghash\+\_\+entry\+\_\+dataptr}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
174\subsubsection{\texorpdfstring{ghash\+\_\+entry\+\_\+dataptr}{ghash\_entry\_dataptr}}
175{\footnotesize\ttfamily \#define ghash\+\_\+entry\+\_\+dataptr(\begin{DoxyParamCaption}\item[{}]{P,  }\item[{}]{L }\end{DoxyParamCaption})~((P)+sizeof(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t})+(L))}
176
177The data structure address within an entry {\ttfamily P} . The offset parameter {\ttfamily L} is the size of the key structure.
178
179Referenced by ghash\+\_\+add(), ghash\+\_\+free(), ghash\+\_\+remove(), and ghash\+\_\+set().
180
181\mbox{\label{group__adt__ghash_ga06408a9495c3264536eb441f2cfe21f0}}
182\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+entry\+\_\+hash@{ghash\+\_\+entry\+\_\+hash}}
183\index{ghash\+\_\+entry\+\_\+hash@{ghash\+\_\+entry\+\_\+hash}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
184\subsubsection{\texorpdfstring{ghash\+\_\+entry\+\_\+hash}{ghash\_entry\_hash}}
185{\footnotesize\ttfamily \#define ghash\+\_\+entry\+\_\+hash(\begin{DoxyParamCaption}\item[{}]{P }\end{DoxyParamCaption})~($\ast$(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t}$\ast$)(P))}
186
187The hash value stored within an entry {\ttfamily P} .
188
189Referenced by ghash\+\_\+add(), ghash\+\_\+find(), ghash\+\_\+insert(), and ghash\+\_\+rehash().
190
191\mbox{\label{group__adt__ghash_ga3f6b74b60133f8479a5351213ad097e9}}
192\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+entry\+\_\+keyptr@{ghash\+\_\+entry\+\_\+keyptr}}
193\index{ghash\+\_\+entry\+\_\+keyptr@{ghash\+\_\+entry\+\_\+keyptr}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
194\subsubsection{\texorpdfstring{ghash\+\_\+entry\+\_\+keyptr}{ghash\_entry\_keyptr}}
195{\footnotesize\ttfamily \#define ghash\+\_\+entry\+\_\+keyptr(\begin{DoxyParamCaption}\item[{}]{P }\end{DoxyParamCaption})~((P)+sizeof(\hyperlink{group__adt_gaab1a0335d8d46afee323cf2b3d132145}{adt\+\_\+hash\+\_\+t}))}
196
197The key structure address within an entry {\ttfamily P} .
198
199Referenced by ghash\+\_\+add(), ghash\+\_\+find(), ghash\+\_\+free(), ghash\+\_\+rehash(), and ghash\+\_\+remove().
200
201\mbox{\label{group__adt__ghash_ga28d6134ab05a63015feb36a32ebc6b0f}}
202\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN}}
203\index{G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
204\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN}{GHASH\_FOREACH\_DEFN}}
205{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+F\+O\+R\+E\+A\+C\+H\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
206
207{\bfseries Value\+:}
208\begin{DoxyCode}
209\textcolor{keywordtype}{void} PREFIX##\_foreach(\textcolor{keyword}{struct} ghash* d, \textcolor{keywordtype}{void} (*fn)(\textcolor{keyword}{struct} PREFIX##\_entry*)) \{ \(\backslash\)
210  ghash\_foreach(d, (\textcolor{keywordtype}{void} (*)(\textcolor{keywordtype}{void}*))fn); \(\backslash\)
211\}
212\end{DoxyCode}
213Define a specialized {\ttfamily ghash} table iterator function. \mbox{\label{group__adt__ghash_gaf8c5a4c9b22f8c620ed8875de9545f3e}}
214\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN}}
215\index{G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
216\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN}{GHASH\_FREE\_DEFN}}
217{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+F\+R\+E\+E\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
218
219{\bfseries Value\+:}
220\begin{DoxyCode}
221\textcolor{keywordtype}{void} PREFIX##\_free(\textcolor{keyword}{struct} ghash* d) \{ \(\backslash\)
222  ghash\_free(d); \(\backslash\)
223\}
224\end{DoxyCode}
225Define a specialized {\ttfamily ghash} table free function. \mbox{\label{group__adt__ghash_gaabe08d7de7829f19e51789b06b1a95da}}
226\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN}}
227\index{G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
228\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN}{GHASH\_GET\_DEFN}}
229{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+G\+E\+T\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE }\end{DoxyParamCaption})}
230
231{\bfseries Value\+:}
232\begin{DoxyCode}
233\textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_get(\textcolor{keyword}{struct} ghash* d, KTYPE \textcolor{keyword}{const}* key) \{ \(\backslash\)
234  return ghash_get(d, key); \(\backslash\)
235\}
236\end{DoxyCode}
237Define a specialized {\ttfamily ghash} table get function. \mbox{\label{group__adt__ghash_ga1cf13ef03b3c316a344d5a7f5af2ef9f}}
238\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+hashb@{ghash\+\_\+hashb}}
239\index{ghash\+\_\+hashb@{ghash\+\_\+hashb}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
240\subsubsection{\texorpdfstring{ghash\+\_\+hashb}{ghash\_hashb}}
241{\footnotesize\ttfamily \#define ghash\+\_\+hashb~\hyperlink{group__adt_gad9ce9e50c1be3b099d94315960807237}{adt\+\_\+hashb}}
242
243The {\ttfamily adt\+\_\+hashb} function also works for ghash \mbox{\label{group__adt__ghash_gaa793802d1ccac89ba8f2450041b19510}}
244\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+hashs@{ghash\+\_\+hashs}}
245\index{ghash\+\_\+hashs@{ghash\+\_\+hashs}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
246\subsubsection{\texorpdfstring{ghash\+\_\+hashs}{ghash\_hashs}}
247{\footnotesize\ttfamily \#define ghash\+\_\+hashs~\hyperlink{group__adt_ga9b98c9ab4f62ccca61ad6903a0ebd798}{adt\+\_\+hashs}}
248
249The {\ttfamily adt\+\_\+hashs} function also works for ghash \mbox{\label{group__adt__ghash_ga67d80747f0e39bdaaaa34c1a3efa45b9}}
250\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+hashsp@{ghash\+\_\+hashsp}}
251\index{ghash\+\_\+hashsp@{ghash\+\_\+hashsp}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
252\subsubsection{\texorpdfstring{ghash\+\_\+hashsp}{ghash\_hashsp}}
253{\footnotesize\ttfamily \#define ghash\+\_\+hashsp~\hyperlink{group__adt_ga7e68b73378693c9b0945a11f849f3063}{adt\+\_\+hashsp}}
254
255The {\ttfamily adt\+\_\+hashsp} function also works for ghash \mbox{\label{group__adt__ghash_ga46a99956ed09905f7f8c32c603347bd3}}
256\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN}}
257\index{G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
258\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN}{GHASH\_INIT\_DEFN}}
259{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+I\+N\+I\+T\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE,  }\item[{}]{H\+A\+S\+H\+FN,  }\item[{}]{C\+MP,  }\item[{}]{K\+C\+O\+PY,  }\item[{}]{D\+C\+O\+PY,  }\item[{}]{K\+F\+R\+EE,  }\item[{}]{D\+F\+R\+EE }\end{DoxyParamCaption})}
260
261{\bfseries Value\+:}
262\begin{DoxyCode}
263\textcolor{keywordtype}{void} PREFIX##\_init(\textcolor{keyword}{struct} ghash* d) \{ \(\backslash\)
264  ghash\_init(d, \(\backslash\)
265             GHASH_KEYSIZE(PREFIX), \(\backslash\)
266             \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} PREFIX##\_entry), \(\backslash\)
267             (adt_hash_fn*)HASHFN, \(\backslash\)
268             (adt_cmp_fn*)CMP, \(\backslash\)
269             (adt_copy_fn*)KCOPY, \(\backslash\)
270             (adt_copy_fn*)DCOPY, \(\backslash\)
271             (adt_free_fn*)KFREE, \(\backslash\)
272             (adt_free_fn*)DFREE); \(\backslash\)
273\}
274\end{DoxyCode}
275Define a specialized {\ttfamily ghash} table init function. \mbox{\label{group__adt__ghash_ga4275ace9d4a3af4cac0ffb37cfb0285a}}
276\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET@{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET}}
277\index{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET@{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
278\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET}{GHASH\_KEYOFFSET}}
279{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+O\+F\+F\+S\+ET(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})~((unsigned long)\&((struct P\+R\+E\+F\+IX\#\#\+\_\+entry$\ast$)0)-\/$>$key)}
280
281The offset of the key into a specialized {\ttfamily ghash} entry. \mbox{\label{group__adt__ghash_ga3464d7a289b27e168f574b1d8f8a8be3}}
282\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE@{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE}}
283\index{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE@{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
284\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE}{GHASH\_KEYSIZE}}
285{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+K\+E\+Y\+S\+I\+ZE(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
286
287{\bfseries Value\+:}
288\begin{DoxyCode}
289( \(\backslash\)
290  GHASH\_DATAOFFSET(PREFIX)-GHASH_KEYOFFSET(PREFIX) \(\backslash\)
291)
292\end{DoxyCode}
293The actual size of the key data in a specialized {\ttfamily ghash} entry. \mbox{\label{group__adt__ghash_ga5462bc3c7d1eea455b6733ce60bd39d5}}
294\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN}}
295\index{G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
296\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN}{GHASH\_REBUILD\_DEFN}}
297{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+R\+E\+B\+U\+I\+L\+D\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
298
299{\bfseries Value\+:}
300\begin{DoxyCode}
301\textcolor{keywordtype}{int} PREFIX##\_rebuild(\textcolor{keyword}{struct} ghash* d) \{ \(\backslash\)
302  return ghash_rebuild(d); \(\backslash\)
303\}
304\end{DoxyCode}
305Define a specialized {\ttfamily ghash} table rebuild function. \mbox{\label{group__adt__ghash_ga2293adaa2df56053b058ff937e7c7254}}
306\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN}}
307\index{G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
308\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN}{GHASH\_REHASH\_DEFN}}
309{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+R\+E\+H\+A\+S\+H\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
310
311{\bfseries Value\+:}
312\begin{DoxyCode}
313\textcolor{keywordtype}{int} PREFIX##\_rehash(\textcolor{keyword}{struct} ghash* d) \{ \(\backslash\)
314  return ghash_rehash(d); \(\backslash\)
315\}
316\end{DoxyCode}
317Define a specialized {\ttfamily ghash} table rehash function. \mbox{\label{group__adt__ghash_ga4de5f1ce7dc082245c22f16635a9f5c5}}
318\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN}}
319\index{G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
320\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN}{GHASH\_REMOVE\_DEFN}}
321{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+R\+E\+M\+O\+V\+E\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE }\end{DoxyParamCaption})}
322
323{\bfseries Value\+:}
324\begin{DoxyCode}
325\textcolor{keyword}{extern} \textcolor{keywordtype}{int} PREFIX##\_remove(\textcolor{keyword}{struct} ghash* d, KTYPE \textcolor{keyword}{const}* key) \{ \(\backslash\)
326  return ghash_remove(d, (\textcolor{keywordtype}{void}*)key); \(\backslash\)
327\}
328\end{DoxyCode}
329Define a specialized {\ttfamily ghash} table remove function. \mbox{\label{group__adt__ghash_gae84cc453db9361a299216c9211abc968}}
330\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN}}
331\index{G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
332\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN}{GHASH\_SEARCH\_DEFN}}
333{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+S\+E\+A\+R\+C\+H\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX }\end{DoxyParamCaption})}
334
335{\bfseries Value\+:}
336\begin{DoxyCode}
337\textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_search(\textcolor{keyword}{struct} ghash* d, \textcolor{keywordtype}{int} (*fn)(\textcolor{keyword}{const} \textcolor{keyword}{struct} PREFIX##\_entry*)) \{ \(\backslash\)
338  return ghash_search(d, (\textcolor{keywordtype}{int} (*)(\textcolor{keyword}{const} \textcolor{keywordtype}{void}*))fn); \(\backslash\)
339\}
340\end{DoxyCode}
341Define a specialized {\ttfamily ghash} table search function. \mbox{\label{group__adt__ghash_ga5c819bab0cc126b53ffe8b7c6e38bb27}}
342\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN}}
343\index{G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN@{G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
344\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN}{GHASH\_SET\_DEFN}}
345{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+S\+E\+T\+\_\+\+D\+E\+FN(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE }\end{DoxyParamCaption})}
346
347{\bfseries Value\+:}
348\begin{DoxyCode}
349\textcolor{keyword}{struct }PREFIX##\_entry* PREFIX##\_set(\textcolor{keyword}{struct} ghash* d, \(\backslash\)
350                                    KTYPE \textcolor{keyword}{const}* key, DTYPE \textcolor{keyword}{const}* data) \{ \(\backslash\)
351  return ghash_set(d, key, data); \(\backslash\)
352\}
353\end{DoxyCode}
354Define a specialized {\ttfamily ghash} table add function. \mbox{\label{group__adt__ghash_gada65697b1f72b4e162981b6e5ac590e8}}
355\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY@{G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY}}
356\index{G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY@{G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
357\subsubsection{\texorpdfstring{G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY}{GHASH\_STRUCT\_ENTRY}}
358{\footnotesize\ttfamily \#define G\+H\+A\+S\+H\+\_\+\+S\+T\+R\+U\+C\+T\+\_\+\+E\+N\+T\+RY(\begin{DoxyParamCaption}\item[{}]{P\+R\+E\+F\+IX,  }\item[{}]{K\+T\+Y\+PE,  }\item[{}]{D\+T\+Y\+PE }\end{DoxyParamCaption})}
359
360{\bfseries Value\+:}
361\begin{DoxyCode}
362\textcolor{keyword}{struct }PREFIX##\_entry \{ \(\backslash\)
363  adt\_hash\_t hash; \(\backslash\)
364  KTYPE key; \(\backslash\)
365  DTYPE data; \(\backslash\)
366\}
367\end{DoxyCode}
368Prototype for the {\ttfamily ghash} entry structure, containing a key of type {\ttfamily K\+T\+Y\+PE} and data of type {\ttfamily D\+T\+Y\+PE} . \mbox{\label{group__adt__ghash_ga7db779509845eb235a86abc751e44887}}
369\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghashiter\+\_\+loop@{ghashiter\+\_\+loop}}
370\index{ghashiter\+\_\+loop@{ghashiter\+\_\+loop}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
371\subsubsection{\texorpdfstring{ghashiter\+\_\+loop}{ghashiter\_loop}}
372{\footnotesize\ttfamily \#define ghashiter\+\_\+loop(\begin{DoxyParamCaption}\item[{}]{I,  }\item[{}]{G }\end{DoxyParamCaption})~for(\hyperlink{group__adt__ghash_ga3c21bcee8850adc76bee68ee8dd7df3e}{ghashiter\+\_\+first}(I,G);\hyperlink{group__adt__ghash_ga03c8f3d628d6ea8c54ecffe4e892178f}{ghashiter\+\_\+valid}(I);\hyperlink{group__adt__ghash_ga733a92b13ce772e7e3810ea65fcd6454}{ghashiter\+\_\+next}(I))}
373
374A convenience macro which expands to a {\ttfamily for} loop using the {\ttfamily ghashiter} I to iterate over the table {\ttfamily G} . \begin{Desc}
375\item[Examples\+: ]\par
376\hyperlink{adt_2ghash_test_8c-example}{adt/ghash\+\_\+test.\+c}.\end{Desc}
377
378
379\subsection{Function Documentation}
380\mbox{\label{group__adt__ghash_ga6550c0dfe54e19112959dba7b164058a}}
381\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+add@{ghash\+\_\+add}}
382\index{ghash\+\_\+add@{ghash\+\_\+add}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
383\subsubsection{\texorpdfstring{ghash\+\_\+add()}{ghash\_add()}}
384{\footnotesize\ttfamily void$\ast$ ghash\+\_\+add (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{const void $\ast$}]{key,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}
385
386Add an entry into a generic hash table. This function adds a new entry into the given hash table. If the table is too small to provide sufficient slots for efficient access, the table is automatically expanded to the next larger size and all the existing entries are copied over.
387
388References ghash\+::count, ghash\+::datacopy, ghash\+::entrysize, ghash\+\_\+entry\+\_\+dataptr, ghash\+\_\+entry\+\_\+hash, ghash\+\_\+entry\+\_\+keyptr, ghash\+\_\+insert(), ghash\+::hashfn, ghash\+::keycopy, ghash\+::keyfree, and ghash\+::keysize.
389
390
391
392Referenced by ghash\+\_\+set().
393
394\mbox{\label{group__adt__ghash_ga92c681d50d718324d18ea35118593e0b}}
395\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+find@{ghash\+\_\+find}}
396\index{ghash\+\_\+find@{ghash\+\_\+find}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
397\subsubsection{\texorpdfstring{ghash\+\_\+find()}{ghash\_find()}}
398{\footnotesize\ttfamily void$\ast$$\ast$ ghash\+\_\+find (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{const void $\ast$}]{key }\end{DoxyParamCaption})}
399
400Find an entry in a {\ttfamily ghash} table.
401
402\begin{DoxyReturn}{Returns}
403A pointer to the entry structure, or {\ttfamily N\+U\+LL} if the {\ttfamily key} was not found.
404\end{DoxyReturn}
405
406
407References ghash\+\_\+entry\+\_\+hash, ghash\+\_\+entry\+\_\+keyptr, ghash\+::hashfn, ghash\+::keycmp, ghash\+::size, and ghash\+::table.
408
409
410
411Referenced by ghash\+\_\+get(), and ghash\+\_\+remove().
412
413\mbox{\label{group__adt__ghash_ga4778a040ba311b5925ca15d7ca640bf9}}
414\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+foreach@{ghash\+\_\+foreach}}
415\index{ghash\+\_\+foreach@{ghash\+\_\+foreach}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
416\subsubsection{\texorpdfstring{ghash\+\_\+foreach()}{ghash\_foreach()}}
417{\footnotesize\ttfamily void ghash\+\_\+foreach (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{void($\ast$)(void $\ast$entry)}]{fn }\end{DoxyParamCaption})}
418
419Iterate over a {\ttfamily ghash} table, calling a function for each entry.
420
421References ghash\+::size, and ghash\+::table.
422
423\mbox{\label{group__adt__ghash_gae609d6df48e1e10a1391d1c94c1dc9ac}}
424\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+free@{ghash\+\_\+free}}
425\index{ghash\+\_\+free@{ghash\+\_\+free}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
426\subsubsection{\texorpdfstring{ghash\+\_\+free()}{ghash\_free()}}
427{\footnotesize\ttfamily void ghash\+\_\+free (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d }\end{DoxyParamCaption})}
428
429Free all data (and entries) in a {\ttfamily ghash} table.
430
431References ghash\+::datafree, ghash\+\_\+entry\+\_\+dataptr, ghash\+\_\+entry\+\_\+keyptr, ghash\+::keyfree, ghash\+::keysize, ghash\+::size, and ghash\+::table.
432
433\mbox{\label{group__adt__ghash_ga4b02b70d7c67a779a9dca5aa23b7f0f4}}
434\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+get@{ghash\+\_\+get}}
435\index{ghash\+\_\+get@{ghash\+\_\+get}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
436\subsubsection{\texorpdfstring{ghash\+\_\+get()}{ghash\_get()}}
437{\footnotesize\ttfamily void$\ast$ ghash\+\_\+get (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{const void $\ast$}]{key }\end{DoxyParamCaption})}
438
439Find an entry in a {\ttfamily ghash} table.
440
441\begin{DoxyReturn}{Returns}
442A pointer to the data structure or {\ttfamily N\+U\+LL} if the {\ttfamily key} was not found.
443\end{DoxyReturn}
444
445
446References ghash\+\_\+find().
447
448
449
450Referenced by ghash\+\_\+set().
451
452\mbox{\label{group__adt__ghash_ga5b2766288f28271bbcf0c45f17e82b89}}
453\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+init@{ghash\+\_\+init}}
454\index{ghash\+\_\+init@{ghash\+\_\+init}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
455\subsubsection{\texorpdfstring{ghash\+\_\+init()}{ghash\_init()}}
456{\footnotesize\ttfamily void ghash\+\_\+init (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{unsigned long}]{keysize,  }\item[{unsigned long}]{entrysize,  }\item[{\hyperlink{group__adt_gad6ce53fbc11dbf67ca1c126cd17ee81a}{adt\+\_\+hash\+\_\+fn} $\ast$}]{hashfn,  }\item[{\hyperlink{group__adt_ga03ed35b7331128b069dc77ab33798782}{adt\+\_\+cmp\+\_\+fn} $\ast$}]{keycmp,  }\item[{\hyperlink{group__adt_gaa98f7f3499407a5dc1afdcbb20df2e15}{adt\+\_\+copy\+\_\+fn} $\ast$}]{keycopy,  }\item[{\hyperlink{group__adt_gaa98f7f3499407a5dc1afdcbb20df2e15}{adt\+\_\+copy\+\_\+fn} $\ast$}]{datacopy,  }\item[{\hyperlink{group__adt_ga87ba7ca9dce36c22fe75a730a1d768a9}{adt\+\_\+free\+\_\+fn} $\ast$}]{keyfree,  }\item[{\hyperlink{group__adt_ga87ba7ca9dce36c22fe75a730a1d768a9}{adt\+\_\+free\+\_\+fn} $\ast$}]{datafree }\end{DoxyParamCaption})}
457
458Initialize an empty {\ttfamily ghash} table.
459
460References ghash\+::count, ghash\+::datacopy, ghash\+::datafree, ghash\+::entrysize, ghash\+::hashfn, ghash\+::keycmp, ghash\+::keycopy, ghash\+::keyfree, ghash\+::keysize, ghash\+::size, and ghash\+::table.
461
462\mbox{\label{group__adt__ghash_gae774815d548201157ed715de43e3ea9d}}
463\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+insert@{ghash\+\_\+insert}}
464\index{ghash\+\_\+insert@{ghash\+\_\+insert}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
465\subsubsection{\texorpdfstring{ghash\+\_\+insert()}{ghash\_insert()}}
466{\footnotesize\ttfamily void ghash\+\_\+insert (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{void $\ast$}]{e }\end{DoxyParamCaption})}
467
468Insert an entry into a {\ttfamily ghash} table, without resizing it.
469
470References ghash\+::count, ghash\+\_\+entry\+\_\+hash, ghash\+::size, and ghash\+::table.
471
472
473
474Referenced by ghash\+\_\+add(), ghash\+\_\+rebuild(), and ghash\+\_\+remove().
475
476\mbox{\label{group__adt__ghash_ga6a6bba38a9aaf20a6b10eeaabaa9b869}}
477\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+rebuild@{ghash\+\_\+rebuild}}
478\index{ghash\+\_\+rebuild@{ghash\+\_\+rebuild}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
479\subsubsection{\texorpdfstring{ghash\+\_\+rebuild()}{ghash\_rebuild()}}
480{\footnotesize\ttfamily int ghash\+\_\+rebuild (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d }\end{DoxyParamCaption})}
481
482Rebuild the entry pointer table in a {\ttfamily ghash} table. This function is used internally after either rehashing the table or removing an entry.
483
484References ghash\+::count, ghash\+\_\+insert(), ghash\+::size, and ghash\+::table.
485
486
487
488Referenced by ghash\+\_\+rehash().
489
490\mbox{\label{group__adt__ghash_ga4beb7c3192aa1ee02a8bf0142758e1af}}
491\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+rehash@{ghash\+\_\+rehash}}
492\index{ghash\+\_\+rehash@{ghash\+\_\+rehash}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
493\subsubsection{\texorpdfstring{ghash\+\_\+rehash()}{ghash\_rehash()}}
494{\footnotesize\ttfamily int ghash\+\_\+rehash (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d }\end{DoxyParamCaption})}
495
496Regenerate all the hash values in a {\ttfamily ghash} table and then rebuild it. Use this function when any of the keys change value.
497
498References ghash\+\_\+entry\+\_\+hash, ghash\+\_\+entry\+\_\+keyptr, ghash\+\_\+rebuild(), ghash\+::hashfn, ghash\+::size, and ghash\+::table.
499
500\mbox{\label{group__adt__ghash_gaad78f59b6f21c62f96285d1583e017fb}}
501\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+remove@{ghash\+\_\+remove}}
502\index{ghash\+\_\+remove@{ghash\+\_\+remove}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
503\subsubsection{\texorpdfstring{ghash\+\_\+remove()}{ghash\_remove()}}
504{\footnotesize\ttfamily int ghash\+\_\+remove (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{const void $\ast$}]{key }\end{DoxyParamCaption})}
505
506Remove an entry from a {\ttfamily ghash} table. This function attempts to do the minimum amount of rebuilding necessary to adjust the positions of entries that may fall in the same slot as the newly removed entry.
507
508\begin{DoxyReturn}{Returns}
509True if the entry was found (and removed), false otherwise.
510\end{DoxyReturn}
511
512
513References ghash\+::count, ghash\+::datafree, ghash\+\_\+entry\+\_\+dataptr, ghash\+\_\+entry\+\_\+keyptr, ghash\+\_\+find(), ghash\+\_\+insert(), ghash\+::keyfree, ghash\+::keysize, ghash\+::size, and ghash\+::table.
514
515\mbox{\label{group__adt__ghash_ga0065ab7531db704c0e51250c519693cc}}
516\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+search@{ghash\+\_\+search}}
517\index{ghash\+\_\+search@{ghash\+\_\+search}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
518\subsubsection{\texorpdfstring{ghash\+\_\+search()}{ghash\_search()}}
519{\footnotesize\ttfamily void$\ast$ ghash\+\_\+search (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{int($\ast$)(const void $\ast$entry)}]{fn }\end{DoxyParamCaption})}
520
521Search for the first entry in the {\ttfamily ghash} table for which the given function returns true.
522
523References ghash\+::size, and ghash\+::table.
524
525\mbox{\label{group__adt__ghash_ga199afecbf45d644c8371b612141df54b}}
526\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghash\+\_\+set@{ghash\+\_\+set}}
527\index{ghash\+\_\+set@{ghash\+\_\+set}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
528\subsubsection{\texorpdfstring{ghash\+\_\+set()}{ghash\_set()}}
529{\footnotesize\ttfamily void$\ast$ ghash\+\_\+set (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghash}{ghash} $\ast$}]{d,  }\item[{const void $\ast$}]{key,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}
530
531Replace or add an entry into a generic hash table.
532
533References ghash\+::datacopy, ghash\+::entrysize, ghash\+\_\+add(), ghash\+\_\+entry\+\_\+dataptr, ghash\+\_\+get(), and ghash\+::keysize.
534
535\mbox{\label{group__adt__ghash_ga3c21bcee8850adc76bee68ee8dd7df3e}}
536\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghashiter\+\_\+first@{ghashiter\+\_\+first}}
537\index{ghashiter\+\_\+first@{ghashiter\+\_\+first}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
538\subsubsection{\texorpdfstring{ghashiter\+\_\+first()}{ghashiter\_first()}}
539{\footnotesize\ttfamily void ghashiter\+\_\+first (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghashiter}{ghashiter} $\ast$}]{iter,  }\item[{const struct \hyperlink{structghash}{ghash} $\ast$}]{h }\end{DoxyParamCaption})}
540
541Set a {\ttfamily ghash} iterator to the first element in the table.
542
543References ghashiter\+::ghashp.
544
545\mbox{\label{group__adt__ghash_ga733a92b13ce772e7e3810ea65fcd6454}}
546\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghashiter\+\_\+next@{ghashiter\+\_\+next}}
547\index{ghashiter\+\_\+next@{ghashiter\+\_\+next}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
548\subsubsection{\texorpdfstring{ghashiter\+\_\+next()}{ghashiter\_next()}}
549{\footnotesize\ttfamily void ghashiter\+\_\+next (\begin{DoxyParamCaption}\item[{struct \hyperlink{structghashiter}{ghashiter} $\ast$}]{iter }\end{DoxyParamCaption})}
550
551Advance the {\ttfamily ghash} iterator to the next element in the table.
552
553References ghashiter\+::index.
554
555\mbox{\label{group__adt__ghash_ga03c8f3d628d6ea8c54ecffe4e892178f}}
556\index{adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}!ghashiter\+\_\+valid@{ghashiter\+\_\+valid}}
557\index{ghashiter\+\_\+valid@{ghashiter\+\_\+valid}!adt ghash\+: Generic hash tables.@{adt ghash\+: Generic hash tables.}}
558\subsubsection{\texorpdfstring{ghashiter\+\_\+valid()}{ghashiter\_valid()}}
559{\footnotesize\ttfamily int ghashiter\+\_\+valid (\begin{DoxyParamCaption}\item[{const struct \hyperlink{structghashiter}{ghashiter} $\ast$}]{iter }\end{DoxyParamCaption})}
560
561Check if the {\ttfamily ghash} iterator is still valid.
562
563References ghashiter\+::ghashp, ghashiter\+::index, ghash\+::size, and ghash\+::table.
564
565