Re: [PATCH] Choose syntax



Hello,

On Tue, 12 Jul 2005, Leonard den Ottolander wrote:

> On Tue, 2005-07-12 at 08:41, Roland Illig wrote:
> > exec_syntax_dialog should not use the constant MAX_SYNTAX_FILES, but
> > some parameter names_size. That makes the relation between them tight
> > closer.
>
> As I've explained the caller cannot make any sensible guess about the
> size of the list, so apart from creating it dynamically it's easier to
> just use a sufficiently large char**. Adding a size parameter as you
> propose would only suggest that something sensible can be put into that
> parameter and it can not.

How about informing the caller how much memory should be allocated ? The
caller passes a pointer to integer, which is filled with the number of slots
it allocated, to the callee. The callee finds out that the slots are not
enough, calculates how much slots should be allocated and passes the value
through the integer pointer back to the caller. The caller then allocates
as many slot as are necessary and repeats the call.



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