svn commit: r250638 - in projects/flex-sf: contrib/flex usr.bin/lex/lib
Jung-uk Kim
jkim at FreeBSD.org
Tue May 14 20:17:58 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2013-05-14 16:04:57 -0400, Juli Mallett wrote:
> 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.)
Yeah, it is ugly but it is much simpler than DragonFlyBSD's fix:
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/655ed7a0#patch8
> 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.
The lerrsf_fatal() is not printf-like and it only takes char[], i.e.,
lerrsf_fatal(char *, char[]). It is ugly but I didn't want to break
other uses.
Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (FreeBSD)
iQEcBAEBAgAGBQJRkpsrAAoJECXpabHZMqHO95sH/RjBkzRJyarPqzaKj/Q6ohdi
Iz0q+GPiaOesxfefUkasMQ7VX9ek9JITvYADdodwm9/ch+uo6H5Xcup0GCVGsQIx
Qiz1G24gqxA/uSaBVXp6VD27oZ6/fM6v/ixM/ePAHYhnOJXbwGI9VRyeT6p9U9Rw
HPqJkG6GlI4JsH9Rl2drrQGIkonjfvEF3yDAZChY6Yq1wiFDvqmxr7jH5emY9u/u
agKAu5ShggFn72tDUAMD7j7ia3pKSi7IGO3F390ZnTeNVIeyJ6Ke6N3Qx6EVOZsx
ekKZ2xGYFMFDicTkQPmUfDG0QqNMbYa03nFv7rfNogmBlqw4k/17w8Lk46HIdgY=
=HdpV
-----END PGP SIGNATURE-----
More information about the svn-src-projects
mailing list