[RFC] misc2.c -Wconversion changes

First go at helping out. Hopefully misc2.c goes away, but in the mean time I fixed up the one method in it that had -Wconversion errors, per #567.

xmallocz zeroes the string at the end, no need to double up on nulling it.

After looking, it seemed like a cnt of int was adequate, no callers used larger sizes. Still, should it be size_t?
Because it is more consistent with what's happening under-the-hood. `getc`
returns an `int`, so there's a cast to `char` or `uint8_t` anyway.

I suggested casting on return when he changed everything to `uint8_t`. Then
he changed everything to `char *`, force pushed, and my suggestion became
less justifiable. :)


On Wed, Jul 2, 2014 at 11:34 AM, John Szakmeister <notifications@github.com>
wrote:

> In src/nvim/misc2.c:
>
> >  {
> > -  int i;
> > -  int c;
> > -
> > -  char_u *str = xmallocz(cnt);
> > -  /* Read the string.  Quit when running into the EOF. */
> > -  for (i = 0; i < cnt; ++i) {
> > -    c = getc(fd);
> > +  char *str = xmallocz(cnt);
>
>  I know that using char here works the same as uint8_t, however it would
> be nicer to use an unsigned type as that's what getc returns inside the
> int.
>
> I'm still trying to deduce what you mean by "nicer"--sorry! Is your
> underlying argument here is that it could prevent a subtle bug because a
> platform could (theoretically) use a different mechanism for representing
> numbers, which could cause the character read to be wrong? Or is the
> argument really just that it is more consistent with what's happening
> under-the-hood?
>
> I only ask because avoiding casts is nice, since they can hide bugs. I
> would've swung the other way here said it should be char *. So I'm trying
> to understand your philosophy about this so that I can either amend my
> vision or yours. :-)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/neovim/neovim/pull/907/files#r14459871>.
>