JudySL_funcs(3)
π NAME π
okay bestie, this is the JudySL_funcs page from the Library Functions Manual β itβs the JudySL functions: a C library for creating and accessing a dynamic array, using a null-terminated string as an index (associative array). periodt π
β¨ SYNOPSIS β¨
PPvoid_t JudySLIns( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
int JudySLDel( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
PPvoid_t JudySLGet( Pcvoid_t PJSLArray, const uint8_t * Index, PJError_t PJError);
Word_t JudySLFreeArray(PPvoid_t PPJSLArray, PJError_t PJError);
PPvoid_t JudySLFirst( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
PPvoid_t JudySLNext( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
PPvoid_t JudySLLast( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
PPvoid_t JudySLPrev( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
π¦ DESCRIPTION π¦
okay so first vibe check: 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 JudySL functions. See JudySL(3) for more information. The function call definitions are included here for completeness. π«Ά
ngl, one of the difficulties in using the JudySL function calls lies in determining whether to pass a pointer or the address of a pointer. Since the functions that modify the JudySL array must also modify the pointer to the JudySL 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. π
The JudySL function calls have an additional parameter beyond those specified in the macro calls. This parameter is either a pointer to an error structure, or NULL (in which case the detailed error information is not returned). lowkey important, bestie π
In the following descriptions, the functions are described in terms of how the macros use them (only in the case of #define JUDYERROR_NOTEST 1). This is the suggested use of the macros after your program has been fully debugged. When the JUDYERROR_NOTEST macro is not specified, an error structure is declared to store error information returned from the JudySL functions when an error occurs. π§
Notice the placement of the & in the different functions. iykyk π
π JudySLIns
JudySLIns(&PJSLArray, Index, &JError)
#define JSLI(PValue, PJSLArray, Index) \
PValue = JudyLIns(&PJSLArray, Index, PJE0)
π JudySLDel
JudySLDel(&PJSLArray, Index, &JError)
#define JSLD(Rc_int, PJSLArray, Index) \
Rc_int = JudySLDel(&PJSLArray, Index, PJE0)
π JudySLGet
JudySLGet(PJSLArray, Index, &JError)
#define JSLG(PValue, PJSLArray, Index) \
PValue = JudySLIns(PJSLArray, Index, PJE0)
π JudySLFreeArray
JudySLFreeArray(&PJSLArray, &JError)
#define JSLFA(Rc_word, PJSLArray) \
Rc_word = JudySLFreeArray(&PJSLArray, PJE0)
π JudySLFirst
JudySLFirst(PJSLArray, Index, &JError)
#define JSLF(PValue, PJSLArray, Index) \
PValue = JudySLFirst(PJSLArray, Index, PJE0)
π JudySLNext
JudySLNext(PJSLArray, Index, &JError)
#define JSLN(PValue, PJSLArray, Index) \
PValue = JudySLNext(PJSLArray, Index, PJE0)
π JudySLLast
JudySLLast(PJSLArray, Index, &JError)
#define JSLL(PValue, PJSLArray, Index) \
PValue = JudySLLast(PJSLArray, Index, PJE0)
π JudySLPrev
JudySLPrev(PJSLArray, Index, &JError)
#define JSLP(PValue, PJSLArray, Index) \
PValue = JudySLPrev(PJSLArray, Index, PJE0)
Definitions for all the Judy functions, the types Pvoid_t, Pcvoid_t, PPvoid_t, Word_t, JError_t, and PJError_t, the constants NULL, JU_ERRNO_*, JERR, PPJERR, and PJE0 are provided in the Judy.h header file (/usr/include/Judy.h). β¨
Note, bestie: Callers should define JudySL arrays as typePvoid_t, which can be passed by value to functions that takePcvoid_t(constantPvoid_t), and also by address to functions that takePPvoid_t. π«‘
The return type from most JudySL functions is PPvoid_t so that the values stored in the array can be pointers to other objects, which is a typical usage, or cast to a Word_t * when a pointer to a value is required instead of a pointer to a pointer. iconic behavior ngl π
π AUTHOR π
Judy was invented by Doug Baskins and implemented by Hewlett-Packard. slay π«Ά
π SEE ALSO π
Judy(3)Judy1(3)JudyL(3)JudySL(3)JudyHS(3)malloc()- the Judy website,
http://judy.sourceforge.net, for more information and Application Notes.
later, bestie π β source/version info: Library Functions Manual, page JudySL_funcs(3); date: not listed in the original, and the footer just repeats JudySL_funcs(3). byeee π«Άπ
π¦ where this page comes from
- centos-stream 9: Judy-devel 1.0.5-28.el9 Β· LGPLv2+
- centos-stream 9: Judy-devel 1.0.5-28.el9 Β· LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms