logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

JudyL - C library for creating and accessing a dynamic array of words, using any value of a word as an

Author

       Judy was invented by Doug Baskins and implemented -Packard.

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 JudyL functions.  See JudyL(3) for more information.  The function call definitions are included here
       for completeness.

       One of the difficulties in using the JudyL function calls lies in determining whether to pass  a  pointer
       or  the  address  of  a  pointer.   Since  the functions that modify the JudyL array must also modify the
       pointer to the JudyL 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 JudyL 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).

       In the following descriptions, the functions are described in terms of how the macros use them  (only  in
       the  case of #defineJUDYERROR_NOTEST1).  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 JudyL functions when an error occurs.

       Notice the placement of the & in the different functions.

        JudyLIns(&PJLArray,Index,&JError)

                      #define JLI(PValue, PJLArray, Index)  \
                         PValue = JudyLIns(&PJLArray, Index, PJE0)

        JudyLDel(&PJLArray,Index,&JError)

                      #define JLD(Rc_int, PJLArray, Index)  \
                         Rc_int = JudyLDel(&PJLArray, Index, PJE0)

        JudyLGet(PJLArray,Index,&JError)

                      #define JLG(PValue, PJLArray, Index)  \
                         PValue = JudyLGet(PJLArray, Index, PJE0)

        JudyLCount(PJLArray,Index1,Index2,&JError)

                      #define JLC(Rc_word, PJLArray, Index1, Index2)  \
                         Rc_word = JudyLCount(PJLArray, Index1, Index2, PJE0)

        JudyLByCount(PJLArray,Nth,&Index,&JError)

                      #define JLBC(PValue, PJLArray, Nth, Index) \
                         PValue = JudyLByCount(PJLArray, Nth, &Index, PJE0)

        JudyLFreeArray(&PJLArray,&JError)

                      #define JLFA(Rc_word, PJLArray) \
                         Rc_word = JudyLFreeArray(&PJLArray, PJE0)

        JudyLMemUsed(PJLArray)

                      #define JLMU(Rc_word, PJLArray) \
                         Rc_word = JudyLMemUsed(PJLArray)

        JudyLFirst(PJLArray,&Index,&JError)

                      #define JLF(PValue, PJLArray, Index) \
                         PValue = JudyLFirst(PJLArray, &Index, PJEO)

        JudyLNext(PJLArray,&Index,&JError)

                      #define JLN(PValue, PJLArray, Index) \
                         PValue = JudyLNext(PJLArray, &Index, PJEO)

        JudyLLast(PJLArray,&Index,&JError)

                      #define JLL(PValue, PJLArray, Index) \
                         PValue = JudyLLast(PJLArray, &Index, PJEO)

        JudyLPrev(PJLArray,&Index,&JError)

                      #define JLP(PValue, PJLArray, Index) \
                         PValue = JudyLPrev(PJLArray, &Index, PJEO)

        JudyLFirstEmpty(PJLArray,&Index,&JError)

                      #define JLFE(Rc_int, PJLArray, Index) \
                         Rc_int = JudyLFirstEmpty(PJLArray, &Index, PJEO)

        JudyLNextEmpty(PJLArray,&Index,&JError)

                      #define JLNE(Rc_int, PJLArray, Index) \
                         Rc_int = JudyLNextEmpty(PJLArray, &Index, PJEO)

        JudyLLastEmpty(PJLArray,&Index,&JError)

                      #define JLLE(Rc_int, PJLArray, Index) \
                         Rc_int = JudyLLastEmpty(PJLArray, &Index, PJEO)

        JudyLPrevEmpty(PJLArray,&Index,&JError)

                      #define JLPE(Rc_int, PJLArray, Index) \
                         Rc_int = JudyLPrevEmpty(PJLArray, &Index, PJEO)

       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:  Callers should define JudyL arrays as type Pvoid_t, which can be passed by
       value  to  functions  that  take  Pcvoid_t (constant Pvoid_t), and also by address to functions that take
       PPvoid_t.

       The return type from most JudyL 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.

Name

       JudyL  -  C  library for creating and accessing a dynamic array of words, using any value of a word as an
       index

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.

                                                                                                  JudyL_funcs(3)

Synopsis

PPvoid_tJudyLIns(PPvoid_tPPJLArray,Word_tIndex,PJError_tPJError);intJudyLDel(PPvoid_tPPJLArray,Word_tIndex,PJError_tPJError);PPvoid_tJudyLGet(Pcvoid_tPJLArray,Word_tIndex,PJError_tPJError);Word_tJudyLCount(Pcvoid_tPJLArray,Word_tIndex1,Word_tIndex2,PJError_tPJError);PPvoid_tJudyLByCount(Pcvoid_tPJLArray,Word_tNth,Word_t*PIndex,PJError_tPJError);Word_tJudyLFreeArray(PPvoid_tPPJLArray,PJError_tPJError);Word_tJudyLMemUsed(Pcvoid_tPJLArray);PPvoid_tJudyLFirst(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);PPvoid_tJudyLNext(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);PPvoid_tJudyLLast(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);PPvoid_tJudyLPrev(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);intJudyLFirstEmpty(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);intJudyLNextEmpty(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);intJudyLLastEmpty(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);intJudyLPrevEmpty(Pcvoid_tPJLArray,Word_t*PIndex,PJError_tPJError);

See Also