Date: Tue, 14 May 2013 13:04:57 -0700 From: Juli Mallett <jmallett@FreeBSD.org> To: Jung-uk Kim <jkim@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r250638 - in projects/flex-sf: contrib/flex usr.bin/lex/lib Message-ID: <CACVs6=8LO1S5hiq3kHu%2Bp27qD3RyRtCJu0M3-tpbeCZzKx4emg@mail.gmail.com> In-Reply-To: <201305141916.r4EJGs2Y056601@svn.freebsd.org> References: <201305141916.r4EJGs2Y056601@svn.freebsd.org>
index | next in thread | previous in thread | raw e-mail
On Tue, May 14, 2013 at 12:16 PM, Jung-uk Kim <jkim@freebsd.org> wrote:
> Log:
> Fix build with GCC.
> Modified: projects/flex-sf/contrib/flex/scanflags.c
> ==============================================================================
> --- projects/flex-sf/contrib/flex/scanflags.c Tue May 14 17:32:13 2013 (r250637)
> +++ projects/flex-sf/contrib/flex/scanflags.c Tue May 14 19:16:54 2013 (r250638)
> @@ -62,7 +62,7 @@ sf_init (void)
> _sf_stk = (scanflags_t*) flex_alloc ( sizeof(scanflags_t) * (_sf_max = 32));
> if (!_sf_stk)
> lerrsf_fatal(_("Unable to allocate %ld of stack"),
> - (long)sizeof(scanflags_t));
> + (void *)(uintptr_t)sizeof(scanflags_t));
> _sf_stk[_sf_top_ix] = 0;
> }
This looks pretty strange. Moreover, it's not clear to me what the
benefit is of showing the sizeof scanflags_t, which isn't the amount
attempting to be allocated anyway, it's sizeof scanflags_t * 32,
right? (The assignment in the multiplication in the allocation is
pretty shady, too.)
But really, why does %ld expect a pointer? Is lerrsf_fatal some
esoteric thing that doesn't take varargs or use normal format strings?
If not, just use %zu and get rid of the cast rollercoaster? The
pointer cast is pretty astonishingly-odd anyway.
Juli.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACVs6=8LO1S5hiq3kHu%2Bp27qD3RyRtCJu0M3-tpbeCZzKx4emg>
