@@ -547,6 +547,9 @@ netCDF library.
547547If a the path is a DAP URL, then the open mode is read-only.
548548Setting NC_WRITE will be ignored.
549549
550+ As of version 4.3.1.2, multiple calls to nc_open with the same
551+ path will return the same ncid value.
552+
550553\note When opening a netCDF-4 file HDF5 error reporting is turned off,
551554if it is on. This doesn't stop the HDF5 error stack from recording the
552555errors, it simply stops their display to the user through stderr.
@@ -1034,9 +1037,11 @@ nc_abort(int ncid)
10341037 int stat = NC_check_id (ncid , & ncp );
10351038 if (stat != NC_NOERR ) return stat ;
10361039
1040+ #ifdef USE_REFCOUNT
10371041 /* What to do if refcount > 0? */
10381042 /* currently, forcibly abort */
10391043 ncp -> refcount = 0 ;
1044+ #endif
10401045
10411046 stat = ncp -> dispatch -> abort (ncid );
10421047 del_from_NCList (ncp );
@@ -1091,8 +1096,10 @@ nc_close(int ncid)
10911096 int stat = NC_check_id (ncid , & ncp );
10921097 if (stat != NC_NOERR ) return stat ;
10931098
1099+ #ifdef USE_REFCOUNT
10941100 ncp -> refcount -- ;
10951101 if (ncp -> refcount <= 0 )
1102+ #endif
10961103 {
10971104 stat = ncp -> dispatch -> close (ncid );
10981105 /* Remove from the nc list */
@@ -1602,6 +1609,11 @@ NC_create(const char *path, int cmode, size_t initialsz,
16021609 /* Add to list of known open files and define ext_ncid */
16031610 add_to_NCList (ncp );
16041611
1612+ #ifdef USE_REFCOUNT
1613+ /* bump the refcount */
1614+ ncp -> refcount ++ ;
1615+ #endif
1616+
16051617 /* Assume create will fill in remaining ncp fields */
16061618 if ((stat = dispatcher -> create (path , cmode , initialsz , basepe , chunksizehintp ,
16071619 useparallel , mpi_info , dispatcher , ncp ))) {
@@ -1651,13 +1663,15 @@ NC_open(const char *path, int cmode,
16511663 nc_initialized = 1 ;
16521664 }
16531665
1666+ #ifdef USE_REFCOUNT
16541667 /* If this path is already open, then bump the refcount and return it */
16551668 ncp = find_in_NCList_by_name (path );
16561669 if (ncp != NULL ) {
16571670 ncp -> refcount ++ ;
16581671 if (ncidp ) * ncidp = ncp -> ext_ncid ;
16591672 return NC_NOERR ;
16601673 }
1674+ #endif
16611675
16621676 isurl = NC_testurl (path );
16631677 if (isurl )
@@ -1749,6 +1763,11 @@ NC_open(const char *path, int cmode,
17491763 /* Add to list of known open files */
17501764 add_to_NCList (ncp );
17511765
1766+ #ifdef USE_REFCOUNT
1767+ /* bump the refcount */
1768+ ncp -> refcount ++ ;
1769+ #endif
1770+
17521771 /* Assume open will fill in remaining ncp fields */
17531772 stat = dispatcher -> open (path , cmode , basepe , chunksizehintp ,
17541773 useparallel , mpi_info , dispatcher , ncp );
0 commit comments