tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] tcc.h (BufferedFile): Remove unnecessary stat


From: Lee Duhem
Subject: Re: [Tinycc-devel] [PATCH] tcc.h (BufferedFile): Remove unnecessary static memory allocation
Date: Fri, 19 Dec 2014 18:29:42 +0800

On Fri, Dec 19, 2014 at 9:04 AM, David Mertens <address@hidden> wrote:
> I agree with your interpretation, and fix. For reference, tcc_open_bf is
> defined in libtcc.c. The two applicable lines are:
>
> int buflen = initlen ? initlen : IO_BUF_SIZE;
> bf = tcc_malloc(sizeof(BufferedFile) + buflen);
>
> As presently defined, BufferedFile indicates that its last field is a string
> with size IO_BUF_SIZE. But this way of allocating things looks like it's
> allocating a struct with a flexible last field, so its size should be 1.
>
> If you apply your patch, do the tests pass?

On x86-64, no regression failure.

lee



reply via email to

[Prev in Thread] Current Thread [Next in Thread]