I agree with you, HASH_FIND_STR is better than HASH_FIND_INT. But we can not use HASH_ADD_STR, its definition is:
#define HASH_ADD_STR(head,strfield,add) \
As you see, it use strlen(add->strfield) to compute the length. But we have not a string inside the structure, because we don’t know how many characters it should have. As the manual said, should use HASH_ADD_KEYPT to add the element. But the version of thash.h doesn’t define the macro.
So, we use HASH_FIND_STR to find the element and use HASH_ADD_INT to add the element?