Branch: Tag:

2016-12-31

2016-12-31 17:12:22 by Arne Goedeke <el@laramies.com>

dynamic_buffer: use new buffer internally

The API of dynamic_buffer is now a slim swapper around the new buffer
API. This changes many places where the dynamic_buffer internals were
directly used.

739:    return ret;   }    - static void free_dynamic_buffer(dynamic_buffer *b) { free(b->s.str); } -  +    static struct pike_string *do_read(int fd,    INT32 r,    int all,
839:    */    dynamic_buffer b;    -  b.s.str=0; +     initialize_buf(&b); -  SET_ONERROR(ebuf, free_dynamic_buffer, &b); +  SET_ONERROR(ebuf, buffer_free, &b);    i = all && !INT32_MUL_OVERFLOW(r, 2) ? DIRECT_BUFSIZE : READ_BUFFER;    do{    int e;
874:    *err=e;    if(!bytes_read)    { -  free(b.s.str); +  buffer_free(&b);    UNSET_ONERROR(ebuf);    return 0;    }
1180:    INT32 try_read;    dynamic_buffer b;    -  b.s.str=0; +     initialize_buf(&b); -  SET_ONERROR(ebuf, free_dynamic_buffer, &b); +  SET_ONERROR(ebuf, buffer_free, &b);    do{    int e;    try_read=MINIMUM(CHUNK,r);
1235:    ERRNO=e;    if(!bytes_read)    { -  free(b.s.str); +  buffer_free(&b);    UNSET_ONERROR(ebuf);    return 0;    }