.TH JudyHS_funcs 3 .SH NAME JudyHS \- C library for creating and accessing a dynamic array, using an array-of-bytes of a length: \fBLength\fP as an \fBIndex\fP and a word as a \fBValue\fP. .PP .SH SYNOPSIS .PP .nf .ps +1 .ft B PPvoid_t JudyHSIns(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError); int JudyHSDel(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError); PPvoid_t JudyHSGet(Pcvoid_t PJHS, void *Index, Word_t Length, PJError_t PJError); Word_t JudyHSFreeArray(PPvoid_t PPJHS, PJError_t PJError); .ft P .ps .fi .PP .SH DESCRIPTION A macro equivalent exists for each function call. Because the macro forms are sometimes faster and have a simpler error handling interface than the equivalent functions, they are the preferred way of calling the JudyHS functions. See \fIJudyHS\fP(3) for more information. The function call definitions are included here for completeness. .PP One of the difficulties in using the JudyHS function calls lies in determining whether to pass a pointer or the address of a pointer. Since the functions that modify the JudyHS array must also modify the pointer to the JudyHS array, you must pass the address of the pointer rather than the pointer itself. This often leads to hard-to-debug programmatic errors. In practice, the macros allow the compiler to catch programming errors when pointers instead of addresses of pointers are passed. .PP The JudyHS function calls have an additional parameter beyond those specified in the macro calls. This parameter is either a pointer to an error structure, or \fBNULL\fP (in which case the error information is not returned -- only \fBPJERR\fP in the return parameter). .PP In the following descriptions, the functions are described in terms of how the macros use them. This is the suggested use of the macros after your program has been fully debugged. When the \fBJUDYERROR_NOTEST\fP macro is not specified, an error structure is declared to store error information returned from the JudyHS functions when an error occurs. .PP Notice the placement of the \fB&\fP in the different functions. .PP .TP 15 \fBJudyHSIns(&PJHS, Index, Length, &JError)\fP .IP .nf .ps +1 #define JHSI(PValue, PJHS, Index) \\ PValue = JudyLIns(&PJHS, Index, PJE0) .IP .ps .fi .IP .TP 15 \fBJudyHSDel(&PJHS, Index, Length, &JError)\fP .IP .nf .ps +1 #define JHSD(Rc_int, PJHS, Index, Length) \\ Rc_int = JudyHSDel(&PJHS, Index, Length, PJE0) .IP .ps .fi .IP .TP 15 \fBJudyHSGet(PJHS, Index, Length)\fP .IP .nf .ps +1 #define JHSG(PValue, PJHS, Index, Length) \\ PValue = JudyHSIns(PJHS, Index, Length) .IP .ps .fi .IP .TP 15 \fBJudyHSFreeArray(&PJHS, &JError)\fP .IP .nf .ps +1 #define JHSFA(Rc_word, PJHS) \\ Rc_word = JudyHSFreeArray(&PJHS, PJE0) .IP .ps .fi .PP Definitions for all the Judy functions, the types \fBPvoid_t\fP, \fBPcvoid_t\fP, \fBPPvoid_t\fP, \fBWord_t \fP, \fBJError_t\fP, and \fBPJError_t\fP, the constants \fBNULL\fP, \fBJU_ERRNO_*\fP, \fBJERR\fP, \fBPPJERR\fP, and \fBPJE0\fP are provided in the \fBJudy.h\fP header file (/usr/include/Judy.h). \fBNote\fP: Callers should define JudyHS arrays as type \fBPvoid_t\fP, which can be passed by value to functions that take \fBPcvoid_t\fP (constant \fBPvoid_t\fP), and also by address to functions that take \fBPPvoid_t\fP. .PP The return type from most \fBJudyHS\fP functions is \fBPPvoid_t\fP so that the values stored in the array can be pointers to other objects, which is a typical usage, or cast to a \fBWord_t *\fP when a pointer to a value is required instead of a pointer to a pointer. .PP .SH AUTHOR JudyHS was invented and implemented by Doug Baskins after retiring \-Packard. .PP .SH SEE ALSO \fIJudy\fP(3), \fIJudy1\fP(3), \fIJudyL\fP(3), \fIJudySL\fP(3), \fIJudyHS\fP(3), .br \fImalloc()\fP, .br the Judy website, \fIhttp://judy.sourceforge.net\fP, for more information and Application Notes.