getwc_unlocked implementation.