bug-make
[Top][All Lists]
Advanced

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

Re: memory allocation


From: Eli Zaretskii
Subject: Re: memory allocation
Date: Tue, 30 Apr 2013 05:33:55 +0300

> From: Paul Smith <address@hidden>
> Cc: Eli Zaretskii <address@hidden>, "address@hidden" <address@hidden>
> Date: Mon, 29 Apr 2013 16:16:40 -0400
> 
> It's probably a good idea for make to provide a "gmk_free()" function
> that will free memory returned to the plugin when it calls gmk_*()
> functions such as gmk_expand().  Is that sufficient to deal with this
> problem?

Yes, I think so.

> Suppose, for example, we enhanced gmk_expand() to take a buffer and a
> plugin invoked:
> 
>     gmk_expand(buf, buflen, "$(info expanding) $(FOO)");
> 
> This will return the expansion of the FOO variable, but it will ALSO
> print "expanding" as the result of calling the info function.  Now
> suppose that the result of expanding $(FOO) was too large to fit into
> buf, so the function returns the length needed and the plugin
> reallocates the buffer to be large enough and re-invokes gmk_expand()...
> now it will print "expanding" AGAIN.

This could be solved, but I think providing gmk_free is much simpler
and will suffice.



reply via email to

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