Date:        Sat, 22 Aug 2015 02:22:00 +0200
    From:        Timo Buhrmester <[email protected]>
    Message-ID:  <[email protected]>

With the possible exception of the added consts, I also don't
like any of the suggested changes - I tend to write "if (p)"
myself often, but that's because I'm lazy - if someone else has
typed the "!= NULL" part, I'd never waste time removing it.

But while most of the changes are just objectionable, this part
is just plain funny (and sad...)

  | +static unsigned
  | +get_uint_or_die(const char *str, const char *name)
  | +{
  | +   int oerrno;
  | +   char *ep;
  | +
  | +   long lval = strtol(str, &ep, 0);
  | +   if (!*str || *ep)
  | +           errx(EXIT_FAILURE, "invalid %s (not a number)", name);
  | +
  | +   oerrno = errno, errno = 0;
  | +
  | +   if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
  | +       || lval < 0 || (unsigned long)lval > UINT_MAX)
  | +           errx(EXIT_FAILURE, "%s out of range", name);
  | +
  | +   errno = oerrno;
  | +
  | +   return (unsigned)lval;
  | +}

Clearly that was never really tested (or even read checked), was it?

kre

Reply via email to