Am 17.06.2016 um 12:00 schrieb Ruediger Pluem:


On 06/16/2016 10:33 PM, Christophe JAILLET wrote:
Hi,


I'm not familiar with sed implementation, but 'copy_to_genbuf' looks spurious.

Actually it only expands a buffer if some space is needed, but nothing is 
copied.


Should it look like:

static void copy_to_genbuf(sed_eval_t *eval, const char* sz)
{
    int len = strlen(sz);
    unsigned int reqsize = len + 1;
    if (eval->gsize < reqsize) {
        grow_gen_buffer(eval, reqsize, NULL);
    }
    memcpy(eval->gspend, sz, len + 1);

The above does a copy, or do I miss your point?

I think Christophe added the memcpy and the below lines as a suggestion ("Should it look like").

    /* hspend will now point to NULL character */
    eval->gspend += len;
}

Regards,

Rainer

Reply via email to