hash_replace macro implementation

Troy,

This is the  same as the patch I sent to the mailing list, just in the form of a pull request. Whichever is easier for you.

Thanks,
-Nick