error in JudyHS man page
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
judy (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
There is a minor, but very confusing error in the example code at the end of the JudyHS man page.
The line
if (*PValue == 0) // check if duplicate
should be changed to
if (*PValue != 0) // check if duplicate
This is because, as explained earlier in the man page, the value associated with a key is initialized to zero when the key is *not* already in the array. So *PValue==0 is true when the line is *not* a duplicate.
This was reported upstream a couple of years ago, but I doubt if it will be fixed there any time soon. See:
http://
Maybe if ubuntu fixes this, the correction will be picked up by other distros, and nobody else will waste time puzzling over this as I did.
I'm attaching .c files with the orig and corrected code. If you compile them, you can verify that the corrected code works as expected, and the orig labels every line of the input file as a duplicate.
Thanks,
-Jeff
tags: | added: manpage |