Simple implementation of newlocale / freelocale.

This removes a couple of errors from libcxx test suites.