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
static void* _wmo_read_any_from_file_malloc(FILE* f, int* err, size_t* size, off_t* offset,
                                            int grib_ok, int bufr_ok, int hdf5_ok, int wrap_ok, int headers_only)
{
    alloc_buffer u;
    reader r;
    u.buffer = NULL;
    u.size   = 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;
    r.offset          = 0;
    *err = read_any(&r, grib_ok, bufr_ok, hdf5_ok, wrap_ok);
    *size   = r.message_size;
    *offset = r.offset;
    return u.buffer;
}
static void * _wmo_read_any_from_file_malloc ( FILE * f , int * err , size_t * size , off_t * offset , int grib_ok , int bufr_ok , int hdf5_ok , int wrap_ok , int headers_only ) { alloc_buffer u ; reader r ; u . buffer = NULL ; u . size = 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 ; r . offset = 0 ; * err = read_any ( & r , grib_ok , bufr_ok , hdf5_ok , wrap_ok ) ; * 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