Dear Judy Masters,
I am having trouble with the following program that uses Judy Arrays. I
know the program appears to be an inefficient method to achieve a certain
goal, but it is the simplest program that demonstrates my problem. I would
be very grateful if someone could take a look at what I am doing wrong.
The problem is essentially this: stepping through the program with the
debugger causes the counter variable to follow the sequence 0,1,2,1.
Rather, I am expecting the sequence to be 0,1,2,3 by the successive
addition of a new entry to the relevant J1 Array.
I am using icc to compile both Judy and the sample program.
Thank you very much
Matthew
#include <stdio.h>
#include <stdlib.h>
#include "Judy.h"
int main(void){
printf("Hello Everyone");
int Rc_int;
Word_t *PValue;
Word_t Value;
Pvoid_t PArray;
Pvoid_t Ref;
Pvoid_t newPair;
Pvoid_t storage;
//A counter variable
Word_t counter=0;
newPair = (Pvoid_t) NULL;
J1S(Rc_int, newPair, 1);
J1S(Rc_int, newPair, 2);
PArray = (Pvoid_t) NULL;
J1S(Rc_int, PArray, (Word_t)newPair);
storage = (Pvoid_t) NULL;
JLI(PValue, storage, 2);
*PValue = (Word_t)PArray;
JLG(PValue, storage, 2);
Value = *PValue;
Ref = (Pvoid_t)Value;
J1C(counter, Ref, 0, -1);
newPair = (Pvoid_t)NULL;
J1S(Rc_int, newPair, 3);
J1S(Rc_int, newPair, 4);
JLG(PValue, storage, 2);
Value = *PValue;
PArray = (Pvoid_t)Value;
J1S(Rc_int, PArray, (Word_t)newPair);
JLG(PValue, storage, 2);
Value = *PValue;
Ref = (Pvoid_t)Value;
J1C(counter, Ref, 0, -1);
newPair = (Pvoid_t) NULL;
J1S(Rc_int, newPair, 5);
J1S(Rc_int, newPair, 6);
JLG(PValue, storage, 2);
Value = *PValue;
PArray = (Pvoid_t)Value;
J1S(Rc_int, PArray, (Word_t)newPair);
JLG(PValue, storage, 2);
Value = *PValue;
Ref = (Pvoid_t)Value;
J1C(counter, Ref, 0, -1);
return 0;
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel