Merge lp:~millihenrik/hashit/man-pages into lp:hashit

Proposed by Henrik Holst
Status: Merged
Approved by: David Gómez
Approved revision: 32
Merged at revision: 32
Proposed branch: lp:~millihenrik/hashit/man-pages
Merge into: lp:hashit
Diff against target: 554 lines (+460/-3)
13 files modified
CMakeLists.txt (+17/-2)
INSTALL (+7/-1)
man/hashit_create.3 (+67/-0)
man/hashit_delete.3 (+37/-0)
man/hashit_destroy.3 (+32/-0)
man/hashit_getkeys.3 (+36/-0)
man/hashit_getvalues.3 (+35/-0)
man/hashit_insert.3 (+44/-0)
man/hashit_lookup.3 (+36/-0)
man/hashit_replace.3 (+39/-0)
man/hashit_size.3 (+31/-0)
man/hashit_tablesize.3 (+34/-0)
man/libhashit.3 (+45/-0)
To merge this branch: bzr merge lp:~millihenrik/hashit/man-pages
Reviewer Review Type Date Requested Status
David Gómez Approve
Review via email: mp+325132@code.launchpad.net

Description of the change

* provided man pages for the hashit project

To post a comment you must log in.
Revision history for this message
David Gómez (dabisu) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2010-03-12 13:19:03 +0000
3+++ CMakeLists.txt 2017-06-06 00:05:29 +0000
4@@ -12,10 +12,14 @@
5 MESSAGE (FATAL_ERROR "pkg-config not found...")
6 ENDIF (NOT PKG_CONFIG_FOUND)
7
8+set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig"
9+ CACHE PATH "Installation directory for pkgconfig (.pc) files")
10+set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man"
11+ CACHE PATH "Manpage directory")
12+
13 ADD_DEFINITIONS (-DDATADIR=\\\"${CMAKE_INSTALL_PREFIX}/share\\\")
14
15 ADD_LIBRARY (hashit SHARED src/hashit.c src/hfunctions.c)
16-ADD_DEPENDENCIES (hashit src/hashit.c src/hfunctions.c src/hashit.h src/hfunctions.h)
17
18 FILE(WRITE libhashit.pc "prefix=${CMAKE_INSTALL_PREFIX}\n")
19 FILE(APPEND libhashit.pc "libdir=${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}\n")
20@@ -28,7 +32,18 @@
21
22 INSTALL (TARGETS hashit LIBRARY DESTINATION lib${LIB_SUFFIX})
23 INSTALL (FILES src/hashit.h DESTINATION include)
24-INSTALL (FILES libhashit.pc DESTINATION lib${LIB_SUFFIX}/pkg-config)
25+INSTALL (FILES libhashit.pc DESTINATION ${INSTALL_PKGCONFIG_DIR})
26+INSTALL (FILES man/hashit_create.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
27+INSTALL (FILES man/hashit_delete.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
28+INSTALL (FILES man/hashit_destroy.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
29+INSTALL (FILES man/hashit_getkeys.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
30+INSTALL (FILES man/hashit_getvalues.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
31+INSTALL (FILES man/hashit_insert.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
32+INSTALL (FILES man/hashit_lookup.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
33+INSTALL (FILES man/hashit_replace.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
34+INSTALL (FILES man/hashit_size.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
35+INSTALL (FILES man/hashit_tablesize.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
36+INSTALL (FILES man/libhashit.3 DESTINATION ${INSTALL_MAN_DIR}/man3)
37
38 SET_TARGET_PROPERTIES (hashit PROPERTIES VERSION 1.0 SOVERSION 1)
39 SET (LIBRARY_OUTPUT_PATH src)
40
41=== modified file 'INSTALL'
42--- INSTALL 2008-12-18 18:56:03 +0000
43+++ INSTALL 2017-06-06 00:05:29 +0000
44@@ -13,11 +13,17 @@
45
46 $ cmake -DCMAKE_INSTALL_PREFIX=/usr .
47
48- Use CMAKE_BUILD_TYPE=Debug or CMAKE_BUILD_TYPE=Release if you
49+ Use -DCMAKE_BUILD_TYPE=Debug or -DCMAKE_BUILD_TYPE=Release if you
50 wish to select the build type. Default is Release.
51
52 By default hashit is installed /usr/local.
53
54+ Use -DINSTALL_PKGCONFIG_DIR=<path> to install the pkgconfig file to
55+ '<path>/libhashit.pc' instead of the default.
56+
57+ Use -DINSTALL_MAN_DIR=<path> to install the man pages to <path>/man3/
58+ instead of the default.
59+
60 hashit includes a pkg-config file, therefore you only need to use the
61 pkg-config utility in the usual way to link your binary to hashit.
62
63
64=== added directory 'man'
65=== added file 'man/hashit_create.3'
66--- man/hashit_create.3 1970-01-01 00:00:00 +0000
67+++ man/hashit_create.3 2017-06-06 00:05:29 +0000
68@@ -0,0 +1,67 @@
69+.TH LIBHASHIT 3 "2017-06-05"
70+
71+.SH NAME
72+hashit_create
73+
74+.SH SYNOPSIS
75+.B #include <hashit.h>
76+.PP
77+.B hash_t hashit_create(uint32_t \fIsizehint\fB, size_t \fIkeysize\fB, uint32_t(*) \fIhfunc()\fB, int(*) \fIcfunc()\fB, unsigned int \fIflags\fB);
78+
79+.SH DESCRIPTION
80+The \fBhashit_create\fR function creates a hash table which is returned as a hash_t type.
81+.TP
82+.SS Parameters:
83+.RS
84+.TP
85+.B sizehint
86+It's used to give an aproximated desired value for the hash table,
87+the function calculates the real size of the table using this
88+parameter as a hint to the final value.
89+.TP
90+.B keysize
91+This is the size for the data type used as a key in the hash table.
92+Keys are void *, so hashit needs to know how long they are. If key size
93+is 0, is assumed that keys are strings.
94+.TP
95+.B hfunc
96+hfunc is a pointer to the hash function for the hash table. Typically
97+you want to put here the value NULL to use the default hash function.
98+Avaliable hash functions are BOB_HASH(Default) and ONEAT_HASH. You can
99+add your own hash function if you know what are you doing ;).
100+.TP
101+.B cfunc
102+cfunc is the comparation function for the keys data. Semantics are the
103+same that in strcmp function. The function should return 0 if both keys
104+are equal, and a value different from zero if they are not.
105+.TP
106+.B flags
107+flags can have the following values:
108+.RS
109+.TP
110+.B CHAIN_H
111+Hash table uses chaining for handling collisions.
112+.TP
113+.B OADDRESS_H
114+Hash table uses open address hashing for handling collisions.
115+.TP
116+.B OVERFLOW_H
117+Hash table uses an overflow area for handling collisions.
118+.TP
119+If you're not sure about what collision handling your hash table should have, then use CHAIN_H.
120+.RE
121+.RE
122+
123+.SH RETURN VALUE
124+Return value is a reference to the table just created or NULL when the table creation has failed.
125+
126+.SH ERRORS
127+.B EINVAL\fR The \fIcfunc\fR provided was NULL, or \fIflags\fR was invalid.
128+.PP
129+.B ENOMEM\fR Could not allocated memory for the internal table.
130+
131+.SH SEE ALSO
132+hashit_insert(3), hashit_delete(3), hashit_lookup(3),
133+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
134+hashit_tablesize(3), hashit_destroy(3)
135+
136
137=== added file 'man/hashit_delete.3'
138--- man/hashit_delete.3 1970-01-01 00:00:00 +0000
139+++ man/hashit_delete.3 2017-06-06 00:05:29 +0000
140@@ -0,0 +1,37 @@
141+.TH LIBHASHIT 3 "2017-06-05"
142+
143+.SH NAME
144+hashit_delete
145+
146+.SH SYNOPSIS
147+.B #include <hashit.h>
148+.PP
149+.B int hashit_delete(hash_t \fIhtable\fB, void *\fIkey\fB);
150+
151+.SH DESCRIPTION
152+The \fBhashit_delete\fR function deletes a key/data pair that is inside the hash table,
153+.TP
154+.SS Parameters:
155+.RS
156+.TP
157+.B htable
158+Pointer to the hash table, this must be the value returned by the
159+\fBhashit_create(3)\fR function.
160+.TP
161+.B key
162+Pointer to the key value for the element that should be deleted from
163+the hash table. The application has the duty to free the data
164+associated to this key.
165+.RE
166+
167+.SH RETURN VALUE
168+Return value is 0 if hashit_delete succeeded and -1 if delete fails.
169+
170+.SH ERRORS
171+.B EFAULT\fR The \fIkey\fR could not be found in the hash table.
172+
173+.SH SEE ALSO
174+hashit_create(3), hashit_insert(3), hashit_lookup(3),
175+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
176+hashit_tablesize(3), hashit_destroy(3)
177+
178
179=== added file 'man/hashit_destroy.3'
180--- man/hashit_destroy.3 1970-01-01 00:00:00 +0000
181+++ man/hashit_destroy.3 2017-06-06 00:05:29 +0000
182@@ -0,0 +1,32 @@
183+.TH LIBHASHIT 3 "2017-06-05"
184+
185+.SH NAME
186+hashit_destroy
187+
188+.SH SYNOPSIS
189+.B #include <hashit.h>
190+.PP
191+.B int hashit_destroy(hash_t \fIhtable\fB);
192+
193+.SH DESCRIPTION
194+The \fBhashit_destroy\fR function destroys the hash table and free previously allocated memory. This function
195+should be called when all the work with the hash table is finished and it
196+won't be needed again.
197+.TP
198+.SS Parameters:
199+.RS
200+.TP
201+.B htable
202+Pointer to the hash table, this must be the value returned by the
203+\fBhashit_create(3)\fR function.
204+.RE
205+
206+.SH RETURN VALUE
207+Always returns 0.
208+
209+.SH ERRORS
210+.SH SEE ALSO
211+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
212+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
213+hashit_tablesize(3)
214+
215
216=== added file 'man/hashit_getkeys.3'
217--- man/hashit_getkeys.3 1970-01-01 00:00:00 +0000
218+++ man/hashit_getkeys.3 2017-06-06 00:05:29 +0000
219@@ -0,0 +1,36 @@
220+.TH LIBHASHIT 3 "2017-06-05"
221+
222+.SH NAME
223+hashit_getkeys
224+
225+.SH SYNOPSIS
226+.B #include <hashit.h>
227+.PP
228+.B void **hashit_getkeys(hash_t \fIhtable\fB);
229+
230+.SH DESCRIPTION
231+The \fBhashit_getkeys\fR function walks through the hash table and returns all the
232+key values inside it. This way there is no need to keep track of
233+all the keys we've inserted in our table.
234+.TP
235+.SS Parameters:
236+.RS
237+.TP
238+.B htable
239+Pointer to the hash table, this must be the value returned by the
240+\fBhashit_create(3)\fR function.
241+.RE
242+
243+.SH RETURN VALUE
244+Return value is a null terminated array containing all the keys in
245+the hash table, or NULL if a error has ocurred. The returned array
246+must be freed by the caller.
247+
248+.SH ERRORS
249+.B ENOMEM\fR Not enough memory to allocate a new element.
250+
251+.SH SEE ALSO
252+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
253+hashit_replace(3), hashit_getvalues(3), hashit_size(3),
254+hashit_tablesize(3), hashit_destroy(3)
255+
256
257=== added file 'man/hashit_getvalues.3'
258--- man/hashit_getvalues.3 1970-01-01 00:00:00 +0000
259+++ man/hashit_getvalues.3 2017-06-06 00:05:29 +0000
260@@ -0,0 +1,35 @@
261+.TH LIBHASHIT 3 "2017-06-05"
262+
263+.SH NAME
264+hashit_getvalues
265+
266+.SH SYNOPSIS
267+.B #include <hashit.h>
268+.PP
269+.B void **hashit_getvalues(hash_t \fIhtable\fB);
270+
271+.SH DESCRIPTION
272+The \fBhashit_getvalues\fR function walks through the hash table and returns all the
273+data values inside it.
274+.TP
275+.SS Parameters:
276+.RS
277+.TP
278+.B htable
279+Pointer to the hash table, this must be the value returned by the
280+\fBhashit_create(3)\fR function.
281+.RE
282+
283+.SH RETURN VALUE
284+Return value is a null terminated array containing all the data pointers in
285+the hash table, or NULL if a error has ocurred. The returned array
286+must be freed by the caller.
287+
288+.SH ERRORS
289+.B ENOMEM\fR Not enough memory to allocate a new element.
290+
291+.SH SEE ALSO
292+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
293+hashit_replace(3), hashit_getkeys(3), hashit_size(3),
294+hashit_tablesize(3), hashit_destroy(3)
295+
296
297=== added file 'man/hashit_insert.3'
298--- man/hashit_insert.3 1970-01-01 00:00:00 +0000
299+++ man/hashit_insert.3 2017-06-06 00:05:29 +0000
300@@ -0,0 +1,44 @@
301+.TH LIBHASHIT 3 "2017-06-05"
302+
303+.SH NAME
304+hashit_insert
305+
306+.SH SYNOPSIS
307+.B #include <hashit.h>
308+.PP
309+.B int hashit_insert(hash_t \fIhtable\fB, void *\fIkey\fB, void *\fIdata\fB);
310+
311+.SH DESCRIPTION
312+The \fBhashit_insert\fR function inserts a key/data pair in the hash table.
313+.TP
314+All the keys inserted in the table must have the size given at creation time, and all must have the same data type, if not, behavior is undefined.
315+.TP
316+.SS Parameters:
317+.RS
318+.TP
319+.B htable
320+Pointer to the hash table, this must be the value returned by the
321+\fBhashit_create(3)\fR function.
322+.TP
323+.B key
324+Pointer to the key value. It must have been previously allocated
325+by the application that is using the library.
326+.TP
327+.B value
328+Pointer to the data value. It must have been previously allocated by
329+the application that is using the library.
330+.RE
331+
332+.SH RETURN VALUE
333+Return value is 0 if insert succeeded and -1 if insert fails.
334+
335+.SH ERRORS
336+.B EINVAL\fR The \fIkey\fR is already inserted in the hash table.
337+.PP
338+.B ENOMEM\fR Not enough memory to allocate a new element.
339+
340+.SH SEE ALSO
341+hashit_create(3), hashit_delete(3), hashit_lookup(3),
342+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
343+hashit_tablesize(3), hashit_destroy(3)
344+
345
346=== added file 'man/hashit_lookup.3'
347--- man/hashit_lookup.3 1970-01-01 00:00:00 +0000
348+++ man/hashit_lookup.3 2017-06-06 00:05:29 +0000
349@@ -0,0 +1,36 @@
350+.TH LIBHASHIT 3 "2017-06-05"
351+
352+.SH NAME
353+hashit_lookup
354+
355+.SH SYNOPSIS
356+.B #include <hashit.h>
357+.PP
358+.B int hashit_lookup(hash_t \fIhtable\fB, void *\fIkey\fB);
359+
360+.SH DESCRIPTION
361+The \fBhashit_lookup\fR function searches an element in the hash table, using the key passed as parameter and returns the data associated to that key.
362+.TP
363+.SS Parameters:
364+.RS
365+.TP
366+.B htable
367+Pointer to the hash table, this must be the value returned by the
368+\fBhashit_create(3)\fR function.
369+.TP
370+.B key
371+Pointer to a key value for the searched element
372+.RE
373+
374+.SH RETURN VALUE
375+Return value is a pointer to element data for the searched key and NULL
376+if the search operation fails.
377+
378+.SH ERRORS
379+.B EFAULT\fR The \fIkey\fR could not be found in the hash table.
380+
381+.SH SEE ALSO
382+hashit_create(3), hashit_insert(3), hashit_delete(3),
383+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
384+hashit_tablesize(3), hashit_destroy(3)
385+
386
387=== added file 'man/hashit_replace.3'
388--- man/hashit_replace.3 1970-01-01 00:00:00 +0000
389+++ man/hashit_replace.3 2017-06-06 00:05:29 +0000
390@@ -0,0 +1,39 @@
391+.TH LIBHASHIT 3 "2017-06-05"
392+
393+.SH NAME
394+hashit_replace
395+
396+.SH SYNOPSIS
397+.B #include <hashit.h>
398+.PP
399+.B int hashit_replace(hash_t \fIhtable\fB, void *\fIkey\fB void *\fInewvalue\fB);
400+
401+.SH DESCRIPTION
402+The \fBhashit_replace\fR function replaces the data for the element associated to the key 'key' with
403+the data pointer by 'newvalue'.
404+.TP
405+.SS Parameters:
406+.RS
407+.TP
408+.B htable
409+Pointer to the hash table, this must be the value returned by the
410+\fBhashit_create(3)\fR function.
411+.TP
412+.B key
413+Pointer to a key value whose assocciated value will be changed.
414+.TP
415+.B newvalue
416+Pointer to new data to be assigned to this key, if exists.
417+.RE
418+
419+.SH RETURN VALUE
420+Return value is 0 if the replace succeeded or -1 if replace failed.
421+
422+.SH ERRORS
423+.B EFAULT\fR The \fIkey\fR could not be found in the hash table.
424+
425+.SH SEE ALSO
426+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
427+hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
428+hashit_tablesize(3), hashit_destroy(3)
429+
430
431=== added file 'man/hashit_size.3'
432--- man/hashit_size.3 1970-01-01 00:00:00 +0000
433+++ man/hashit_size.3 2017-06-06 00:05:29 +0000
434@@ -0,0 +1,31 @@
435+.TH LIBHASHIT 3 "2017-06-05"
436+
437+.SH NAME
438+hashit_size
439+
440+.SH SYNOPSIS
441+.B #include <hashit.h>
442+.PP
443+.B size_t hashit_size(hash_t \fIhtable\fB);
444+
445+.SH DESCRIPTION
446+The \fBhashit_size\fR function returns the number of elements in the hash table.
447+.TP
448+.SS Parameters:
449+.RS
450+.TP
451+.B htable
452+Pointer to the hash table, this must be the value returned by the
453+\fBhashit_create(3)\fR function.
454+.RE
455+
456+.SH RETURN VALUE
457+The number of elements in the hash table.
458+
459+.SH ERRORS
460+
461+.SH SEE ALSO
462+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
463+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3),
464+hashit_tablesize(3), hashit_destroy(3)
465+
466
467=== added file 'man/hashit_tablesize.3'
468--- man/hashit_tablesize.3 1970-01-01 00:00:00 +0000
469+++ man/hashit_tablesize.3 2017-06-06 00:05:29 +0000
470@@ -0,0 +1,34 @@
471+.TH LIBHASHIT 3 "2017-06-05"
472+
473+.SH NAME
474+hashit_tablesize
475+
476+.SH SYNOPSIS
477+.B #include <hashit.h>
478+.PP
479+.B size_t hashit_tablesize(hash_t \fIhtable\fB);
480+
481+.SH DESCRIPTION
482+The \fBhashit_tablesize\fR function returns the hash table size. This has different meanings depending on the
483+hash collision method used. For example, for chaining hash, it returns
484+the number of buckets in the hash table, for open address its equal to
485+the hash table size (maximum number of elements), for overflow hash it's
486+the size of the main table without the overflow area.
487+.TP
488+.SS Parameters:
489+.RS
490+.TP
491+.B htable
492+Pointer to the hash table, this must be the value returned by the
493+\fBhashit_create(3)\fR function.
494+.RE
495+
496+.SH RETURN VALUE
497+Returns the hash table size.
498+
499+.SH ERRORS
500+.SH SEE ALSO
501+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
502+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
503+hashit_destroy(3)
504+
505
506=== added file 'man/libhashit.3'
507--- man/libhashit.3 1970-01-01 00:00:00 +0000
508+++ man/libhashit.3 2017-06-06 00:05:29 +0000
509@@ -0,0 +1,45 @@
510+.TH LIBHASHIT 3 "2017-06-05"
511+
512+.SH NAME
513+libhashit \- generic hash library with diverse collision methods
514+
515+.SH SYNOPSIS
516+.B #include <hashit.h>
517+.PP
518+.B hash_t hashit_create(uint32_t \fIsizehint\fB, size_t \fIkeysize\fB, uint32_t(*) \fIhfunc()\fB, int(*) \fIcfunc()\fB, unsigned int \fIflags\fB);
519+.PP
520+.B int hashit_insert(hash_t \fIhtable\fB, void *\fIkey\fB, void *\fIdata\fB)
521+.PP
522+.B int hashit_delete(hasht_t \fIhtable\fB, void *\fIkey\fB)
523+.PP
524+.B void *hashit_lookup(hash_t \fIhtable\fB, void *\fIkey\fB)
525+.PP
526+.B int hashit_replace(hash_t \fIhtable\fB, void *\fIkey\fB, void *\fInewvalue\fB)
527+.PP
528+.B void **hashit_getkeys(hash_t \fIhtable\fB)
529+.PP
530+.B void **hashit_getvalues(hash_t \fIhtable\fB)
531+.PP
532+.B size_t hashit_size(hash_t \fIhtable\fB)
533+.PP
534+.B size_t hashit_tablesize(hash_t \fIhtable\fB)
535+.PP
536+.B int hashit_destroy(hash_t \fIhtable\fB)
537+
538+.SH DESCRIPTION
539+hashit is a generic hash library implemented in C which supports multiple collision handling methods.
540+.PP
541+Nowadays not much work is going into it, but it's maintained :), just in case some bug comes out of nowhere.
542+.PP
543+Credit is due to Bob Jenkins, author of the default hash function used in hashit and which is available here along with a lot of material related to hashing.
544+.PP
545+
546+.SH AUTHOR
547+.TP
548+David Gómez <david@pleyades.net>
549+
550+.SH SEE ALSO
551+hashit_create(3), hashit_insert(3), hashit_delete(3), hashit_lookup(3),
552+hashit_replace(3), hashit_getkeys(3), hashit_getvalues(3), hashit_size(3),
553+hashit_tablesize(3), hashit_destroy(3)
554+

Subscribers

People subscribed via source and target branches

to all changes: