Move discard_const hack to memory.hso it can be used by Samba 3.