libnczarr/zattr.c
int
ncz_getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp, NCindex **attlist)
{
    int retval;
    NC_FILE_INFO_T* file = grp->nc4_info;
    NCZ_FILE_INFO_T* zinfo = file->format_file_info;

    assert(grp && attlist && file && zinfo);

    if (varid == NC_GLOBAL)
    {
        /* Do we need to read the atts? */
        if (!grp->atts_read)
            if ((retval = ncz_read_atts(file, (NC_OBJ*)grp)))
                return retval;

        if (varp)
            *varp = NULL;
        *attlist = grp->att;
    }
    else
    {
        NC_VAR_INFO_T *var;

        if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid)))
            return NC_ENOTVAR;
        assert(var->hdr.id == varid);

        /* Do we need to read the atts? */
        if (!var->atts_read)
            if ((retval = ncz_read_atts(file, (NC_OBJ*)var)))
                return retval;

        if (varp)
            *varp = var;
        *attlist = var->att;
    }
    return NC_NOERR;
}
/**
 * @internal Get the attribute list for either a varid or NC_GLOBAL
 *
 * @param grp Group
 * @param varid Variable ID | NC_BLOGAL
 * @param varp Pointer that gets pointer to NC_VAR_INFO_T
 * instance. Ignored if NULL.
 * @param attlist Pointer that gets pointer to attribute list.
 *
 * @return NC_NOERR No error.
 * @author Dennis Heimbigner, Ed Hartnett
 * [Candidate for moving to libsrc4]
 */
@internal Get the attribute list for either a varid or NC_GLOBAL
@param grp Group
@param varid Variable ID | NC_BLOGAL
@param varp Pointer that gets pointer to NC_VAR_INFO_T
instance. Ignored if NULL.
@param attlist Pointer that gets pointer to attribute list.

@return NC_NOERR No error.
@author Dennis Heimbigner, Ed Hartnett
[Candidate for moving to libsrc4]
@internal Get the attribute list for either a varid or NC_GLOBAL @param grp Group @param varid Variable ID | NC_BLOGAL @param varp Pointer that gets pointer to NC_VAR_INFO_T instance . Ignored if NULL . @param attlist Pointer that gets pointer to attribute list . @return NC_NOERR No error . @author Dennis Heimbigner Ed Hartnett [ Candidate for moving to libsrc4 ]
int
ncz_getattlist(NC_GRP_INFO_T *grp, int varid, NC_VAR_INFO_T **varp, NCindex **attlist)
{
    int retval;
    NC_FILE_INFO_T* file = grp->nc4_info;
    NCZ_FILE_INFO_T* zinfo = file->format_file_info;
    assert(grp && attlist && file && zinfo);
    if (varid == NC_GLOBAL)
    {
        if (!grp->atts_read)
            if ((retval = ncz_read_atts(file, (NC_OBJ*)grp)))
                return retval;
        if (varp)
            *varp = NULL;
        *attlist = grp->att;
    }
    else
    {
        NC_VAR_INFO_T *var;
        if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid)))
            return NC_ENOTVAR;
        assert(var->hdr.id == varid);
        if (!var->atts_read)
            if ((retval = ncz_read_atts(file, (NC_OBJ*)var)))
                return retval;
        if (varp)
            *varp = var;
        *attlist = var->att;
    }
    return NC_NOERR;
}
int ncz_getattlist ( NC_GRP_INFO_T * grp , int varid , NC_VAR_INFO_T * * varp , NCindex * * attlist ) { int retval ; NC_FILE_INFO_T * file = grp -> nc4_info ; NCZ_FILE_INFO_T * zinfo = file -> format_file_info ; assert ( grp && attlist && file && zinfo ) ; if ( varid == NC_GLOBAL ) { if ( ! grp -> atts_read ) if ( ( retval = ncz_read_atts ( file , ( NC_OBJ * ) grp ) ) ) return retval ; if ( varp ) * varp = NULL ; * attlist = grp -> att ; } else { NC_VAR_INFO_T * var ; if ( ! ( var = ( NC_VAR_INFO_T * ) ncindexith ( grp -> vars , varid ) ) ) return NC_ENOTVAR ; assert ( var -> hdr . id == varid ) ; if ( ! var -> atts_read ) if ( ( retval = ncz_read_atts ( file , ( NC_OBJ * ) var ) ) ) return retval ; if ( varp ) * varp = var ; * attlist = var -> att ; } return NC_NOERR ; }
@internal Get the attribute list for either a varid or NC_GLOBAL
 @param grp Group
 @param varid Variable ID | NC_BLOGAL
 @param varp Pointer that gets pointer to NC_VAR_INFO_T
 instance.
@internal Get the attribute list for either a varid or NC_GLOBAL @param grp Group @param varid Variable ID | NC_BLOGAL @param varp Pointer that gets pointer to NC_VAR_INFO_T instance .
/* Do we need to read the atts? */ /* Do we need to read the atts? */