Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2005 14:22:25 +0200
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        Brian Somers <brian@freebsd.org>
Cc:        cvs-all@freebsd.org
Subject:   Re: cvs commit: src/usr.sbin/ppp route.c
Message-ID:  <20050110122225.GB2693@orion.daedalusnetworks.priv>
In-Reply-To: <200501101112.j0ABCaEQ062701@repoman.freebsd.org>
References:  <200501101112.j0ABCaEQ062701@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-01-10 11:12, Brian Somers <brian@freebsd.org> wrote:
>
> Cast unsigned variables to int
>
> Revision  Changes    Path
> 1.94      +1 -1      src/usr.sbin/ppp/route.c

%  static void
%  p_flags(struct prompt *prompt, u_int32_t f, unsigned max)
%  {
%    char name[33], *flags;
%    register struct bits *p = bits;
%
%    if (max > sizeof name - 1)
%      max = sizeof name - 1;
%
%    for (flags = name; p->b_mask && flags - name < (int)max; p++)
%      if (p->b_mask & f)
%        *flags++ = p->b_val;
%    *flags = '\0';
% -  prompt_Printf(prompt, "%-*.*s", max, max, name);
% +  prompt_Printf(prompt, "%-*.*s", (int)max, (int)max, name);
%  }

Hi Brian,

Since p_flags is used only once in route.c can't we just fix the type
of `max' in the argument list of p_flags() to avoid the need for casts
altogether?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050110122225.GB2693>