src/grib_io.c
/* This function allocates memory for the result so the user is responsible for freeing it */
This function allocates memory for the result so the user is responsible for freeing it
This function allocates memory for the result so the user is responsible for freeing it
void* wmo_read_any_from_stream_malloc(void* stream_data, long (*stream_proc)(void*, void* buffer, long len), size_t* size, int* err)
{
    alloc_buffer u;
    stream_struct s;
    reader r;
    u.buffer = NULL;
    s.stream_data = stream_data;
    s.stream_proc = stream_proc;
    r.message_size    = 0;
    r.offset          = 0;
    r.read_data       = &s;
    r.read            = &stream_read;
    r.seek            = &stream_seek;
    r.seek_from_start = &stream_seek;
    r.tell            = &stream_tell;
    r.alloc_data      = &u;
    r.alloc           = &allocate_buffer;
    r.headers_only    = 0;
    *err  = read_any(&r, 1, 1, 1, 1);
    *size = r.message_size;
    return u.buffer;
}
void * wmo_read_any_from_stream_malloc ( void * stream_data , long ( * stream_proc ) ( void * , void * buffer , long len ) , size_t * size , int * err ) { alloc_buffer u ; stream_struct s ; reader r ; u . buffer = NULL ; s . stream_data = stream_data ; s . stream_proc = stream_proc ; r . message_size = 0 ; r . offset = 0 ; r . read_data = & s ; r . read = & stream_read ; r . seek = & stream_seek ; r . seek_from_start = & stream_seek ; r . tell = & stream_tell ; r . alloc_data = & u ; r . alloc = & allocate_buffer ; r . headers_only = 0 ; * err = read_any ( & r , 1 , 1 , 1 , 1 ) ; * size = r . message_size ; return u . buffer ; }
This function allocates memory for the result so the user is responsible for freeing it
This function allocates memory for the result so the user is responsible for freeing it