Programming with Judy
Example of a Multi-dimensional Array
Example Code
Chapter 452
// CHECK FOR END OF STRING IN CURRENT indexword:
if (LASTWORD (indexword))
return (PPvalue); // is value for whole Index string.
// CONTINUE TO NEXT LEVEL DOWN JUDYL ARRAY TREE:
//
// If a previous JudySLIns() ran out of memory partway down the tree, it left a
// null *PPvalue; this is automatically treated here as a dead-end.
pos += WORDSIZE;
PArray = *PPvalue; // each value -> next array.
} // while
/*NOTREACHED*/
} // JudySLGet()
// ****************************************************************************
//JUDY SL INS
PPvoid_t JudySLIns (
PPvoid_t PPArray,
const char * Index,
JError_t * PJError)
{
char * pos = (char *)Index;
ulong_t indexword;
PPvoid_t PPvalue;