Simple implementation of newlocale / freelocale.

This removes a couple of errors from libcxx test suites.
Merge pull request #1642 from waywardmonkeys/newlocale-freelocale

newlocale and freelocale