[RFC] api/helpers: implement C string to String helper

@tarruda as suggested by @oni-link we could use `xmemdup` there, which is faster since it avoids an extra `strlen`, and saves a whopping byte of memory ;). To save on lines I abstracted it out into a separate function.

Reference: https://github.com/neovim/neovim/pull/727#discussion_r12768748