server_ptree_walk_masked()

int server_ptree_walk_masked(server_ptree_t **branch, int *temp, unsigned char *input, int input_len, unsigned char mask);

Identical to server_ptree_walk() except it integrates a bitwise AND of the input bytes with the supplied mask value before comparison.

This can be used to facilitate case-insensitivity by using the mask 0x5f. Just keep in mind that if your ptree also incorporates non-alphabetic characters like spaces or newlines, 0x5f may collide. This is true for spaces which are particularly common in ptree paths. The trick is to use '$\backslash$0' instead of ' ' in the ptree path, because ' ' & 0x5f becomes '$\backslash$0'.

This is often a reasonable solution when case permutations are unacceptable due to wasted memory.



2007-12-06