Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/doc/ext/Judy_3.htm  view on Meta::CPAN

This indicates that an error occurred in the <B>JudyLIns()</B> function
at line 321.  Line 1234 is the line in 'YourCfile.c' where the
<B>JLI()</B> call failed.  JU_ERRNO_* == 2 is equal to JU_ERRNO_NOMEM
(as defined in the <B>Judy.h</B> file).  The ID number indicates the
source line number in the function where the error originated.  Your
program then terminates with an <I>exit(1);</I>.  By default, both
categories of Judy error returns are printed this way.  (The 'ID == 321'
is for die hards that want more detail or for debugging Judy itself.)
<BR>
<P>
<DT><B>2) Disable Macro Error Handling</B> </DT>
<DD>
When your program is "bug free", the only errors returned should be
<I>malloc()</I> failures.  Therefore all error returns can be treated as
a <I>malloc()</I> failure.  By using the below <B>#define</B>, all
error testing and printing is turned off.  Additional code needs to be
added to the code that can have <I>malloc()</I> failures.  Judy was
designed to leave the same data in the array before the call if a
<I>malloc()</I> fail occurs.  (During testing of Judy, we found very few
<I>malloc()</I>/OS's that were bug free after a <I>malloc()</I> failure.
Sometimes it took weeks to discover because most systems go into a

src/judy-1.0.5/doc/ext/Judy_3.htm  view on Meta::CPAN

if (RC_int == JERR) goto out_of_memory_handling;
...

J1U(RC_int, P1Array, Index);
if (RC_int == JERR) goto out_of_memory_handling;
...

</PRE>
Note:  Without 'JUDYERROR_NOTEST' defined, the 'goto
out_of_memory_handling' will never be executed and will be optimized out
by the compiler.  The default method will be used -- Macro will print
error information if an error occurs as explained above.
<P>
With 'JUDYERROR_NOTEST' defined, the 'goto out_of_memory_handling' will
be executed when an error occurs -- which should only happen when
<I>malloc()</I> fails.
<DT><B>3) User-Specified JUDYERROR() Macro Method</B> </DT>
<DD>
The <B>JUDYERROR()</B> macro (in <B>Judy.h</B>) provides flexibility for
handling error returns as needed to suit your program while still using
the Judy array macros instead of function calls.  You can use a
different <B>JUDYERROR()</B> macro to suit your needs.  The following
example is a possible alternative to the default. It is used to
distinguish between the two types of errors (described above), and
explicitly test for the remaining JU_ERRNO_NOMEM errors possible in your
program.
<P>

src/judy-1.0.5/src/JudyCommon/JudyGet.c  view on Meta::CPAN

        case cJU_JPIMMED_5_01:
        case cJU_JPIMMED_6_01:
        case cJU_JPIMMED_7_01:
#endif
            if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) break;

  JUDY1CODE(return(1);)
  JUDYLCODE(return((PPvoid_t) &(Pjp->jp_Addr));)  // immediate value area.


//   Macros to make code more readable and avoid dup errors

#ifdef JUDY1

#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX)                       \
if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX))       \
    return(1)

#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY)                   \
{                                                                       \
    Word_t   i_ndex;                                                    \

src/judy-1.0.5/src/apps/demo/funhist.c  view on Meta::CPAN


// Default number of iterations (number of random numbers generated)
// This may be overridden on the command line

#define DEFAULT_ITER 1000000

// The number of buckets the histogram is divided into.

#define DEFAULT_HISTO_BUCKETS 32

// Macro for correction english output for plurals

#define	PLURAL(count) ((count == 1) ? "" : "s")

// timing routines

struct timeval TBeg, TEnd;
#define STARTTm         gettimeofday(&TBeg, NULL)
#define ENDTm           gettimeofday(&TEnd, NULL)
#define DeltaUSec                                       \
        ((double)(TEnd.tv_sec - TBeg.tv_sec) * 1E6 +    \

src/judy-1.0.5/tool/jhton.c  view on Meta::CPAN


// Prefix for printf formats:

#define	FILELINE "File \"%s\", line %d: "

// Common error string:

char * FmtErrLineEnds = FILELINE "Input line ends within an HTML tag; for this "
			"translator, all tags must be on a single input line";

// Macros for skipping whitespace or non-whitespace; in the latter case,
// stopping at end of line or end of tag:

#define	SKIPSPACE(Pch)	   { while (ISSPACE(*(Pch))) ++(Pch); }

#define	SKIPNONSPACE(Pch)  { while ((! ISSPACE(*(Pch))) \
				 && (*(Pch) != CHNULL)  \
				 && (*(Pch) != '>')) ++(Pch); }

// Highest line number + 1, and last input line number that caused output:



( run in 0.535 second using v1.01-cache-2.11-cpan-49f99fa48dc )