Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit d07bae0

Browse files
author
Nicolas Cornu
authored
Small cleaning (#808)
1 parent 39f8fb7 commit d07bae0

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

coreneuron/apps/main1.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ extern "C" void mk_mech_init(int argc, char** argv) {
516516
}
517517

518518
// reads mechanism information from bbcore_mech.dat
519-
520519
mk_mech((corenrn_param.datpath).c_str());
521520
}
522521

coreneuron/io/nrn_filehandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FileHandler::FileHandler(const std::string& filename)
1717
this->open(filename);
1818
}
1919

20-
bool FileHandler::file_exist(const std::string& filename) const {
20+
bool FileHandler::file_exist(const std::string& filename) {
2121
struct stat buffer;
2222
return (stat(filename.c_str(), &buffer) == 0);
2323
}

coreneuron/io/nrn_filehandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class FileHandler {
6161
return F.fail();
6262
}
6363

64-
bool file_exist(const std::string& filename) const;
64+
static bool file_exist(const std::string& filename);
6565

6666
/** nothing more to read */
6767
bool eof();

coreneuron/io/nrn_setup.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ inline void* phase_wrapper_w(NrnThread* nt, UserParams& userParams, bool in_memo
117117
".dat";
118118

119119
// Avoid trying to open the gid_gap.dat file if it doesn't exist when there are no
120-
// gap junctions in this gid
121-
if (P == gap && !userParams.file_reader[i].file_exist(fname)) {
120+
// gap junctions in this gid.
121+
// Note that we still need to close `userParams.file_reader[i]`
122+
// because files are opened in the order of `gid_1.dat`, `gid_2.dat` and `gid_gap.dat`.
123+
// When we open next file, `gid_gap.dat` in this case, we are supposed to close the
124+
// handle for `gid_2.dat` even though file doesn't exist.
125+
if (P == gap && !FileHandler::file_exist(fname)) {
122126
userParams.file_reader[i].close();
123127
} else {
124128
// if no file failed to open or not opened at all

coreneuron/mechanism/mech/cfile/cabvars.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ static void (*mechanism[])(void) = {/* type will start at 3 */
2222
/* extracellular requires special handling and must be type 5 */
2323
extracell_reg_,
2424
#endif
25-
0};
25+
nullptr};
2626

2727
} // namespace coreneuron

tests/integration/ring_gap/mod files/halfgap.mod

100755100644
File mode changed.

0 commit comments

Comments
 (0)