My default comment on the PRs that replace old allocation functions with
xmalloc() is that you shouldn't miss the opportunity to perform additional
refactorings. The reason I went slowly on converting all functions.

In the first lines of this diff I saw `xmalloc(STRLEN(str))`. This can be
replaced by `xmalloc(strlen((char_u*)str)`.

One should also consider changing the type of local variables to size_t and
char*.

It's easier to preform and review these changes along with the `alloc`
replacements.