Re: [exim] dlfunc yield value protocol

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jeremy Harris
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] dlfunc yield value protocol
On 28/01/2019 19:00, Ian Zimmerman via Exim-users wrote:
> On 2019-01-24 14:10, Ian Zimmerman wrote:
>
>> On 2019-01-24 20:44, Jeremy Harris wrote:
>>
>>> string_sprintf()
>>> string_copy()
>>> string_copyn()
>>
>> Exactly what I was hoping for! Thanks.
>
> A follow-up question. Can I do the analogue of realloc()?
>
> I am trying to construct a list (in the Exim sense) and return it from
> the dlfunc module. I don't know a priori how long the list will be or
> how many elements.


Not with the documented API.

The internal way to do it would be one of

    string_append_listele()
    string_append_listele_n()


    string_cat()
    string_catn()


... all of which deal in objects called "growable string".
You don't need to alloc or realloc at all.
--
Cheers,
Jeremy