svn commit: r250638 - in projects/flex-sf: contrib/flex usr.bin/lex/lib
Juli Mallett
jmallett at FreeBSD.org
Tue May 14 20:05:25 UTC 2013
On Tue, May 14, 2013 at 12:16 PM, Jung-uk Kim <jkim at 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.
More information about the svn-src-projects
mailing list