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_gts_from_file_malloc(FILE* f, int headers_only, size_t* size, off_t* offset, int* err)
{
    alloc_buffer u;
    reader r;
    u.buffer = NULL;
    r.offset = 0;
    r.message_size    = 0;
    r.read_data       = f;
    r.read            = &stdio_read;
    r.seek            = &stdio_seek;
    r.seek_from_start = &stdio_seek_from_start;
    r.tell            = &stdio_tell;
    r.alloc_data      = &u;
    r.alloc           = &allocate_buffer;
    r.headers_only    = headers_only;
    *err    = read_any_gts(&r);
    *size   = r.message_size;
    *offset = r.offset;
    return u.buffer;
}
void * wmo_read_gts_from_file_malloc ( FILE * f , int headers_only , size_t * size , off_t * offset , int * err ) { alloc_buffer u ; reader r ; u . buffer = NULL ; r . offset = 0 ; r . message_size = 0 ; r . read_data = f ; r . read = & stdio_read ; r . seek = & stdio_seek ; r . seek_from_start = & stdio_seek_from_start ; r . tell = & stdio_tell ; r . alloc_data = & u ; r . alloc = & allocate_buffer ; r . headers_only = headers_only ; * err = read_any_gts ( & r ) ; * size = r . message_size ; * offset = r . offset ; 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