Skip to content

Commit

Permalink
reinserted some coding style notes
Browse files Browse the repository at this point in the history
  • Loading branch information
diekhans committed May 11, 2019
1 parent ea84fd6 commit f5a1473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CODING_STYLE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ For emacs users, this is set automatically from `.dir.locals.el`.

The `clang-format` program was used '.clang-format' as a configuration.

Other conventions:
- member variables: begin with _
- never use "using namespace" in a header file
17 changes: 2 additions & 15 deletions api/mmap_impl/mmapFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,9 @@ int hal::MMapFileLocal::openFile() {
} else {
openMode = O_RDONLY;
}
try_open:
int fd = ::open(_alignmentPath.c_str(), openMode, 0666);
if (fd < 0) {
if (errno == EINTR) {
goto try_open;
} else {
throw hal_errno_exception(_alignmentPath, "open failed", errno);
}
}
return fd;
}
Expand All @@ -165,11 +160,7 @@ int hal::MMapFileLocal::openFile() {
void hal::MMapFileLocal::adjustFileSize(size_t size) {
try_truncate:
if (ftruncate(_fd, size) < 0) {
if (errno == EINTR) {
goto try_truncate;
} else {
throw hal_errno_exception(_alignmentPath, "set size failed", errno);
}
throw hal_errno_exception(_alignmentPath, "set size failed", errno);
}
_fileSize = size;
}
Expand Down Expand Up @@ -236,11 +227,7 @@ void hal::MMapFileLocal::closeFile() {
if (_fd >= 0) {
try_close:
if (::close(_fd) < 0) {
if (errno == EINTR) {
goto try_close;
} else {
throw hal_errno_exception(_alignmentPath, "close failed", errno);
}
throw hal_errno_exception(_alignmentPath, "close failed", errno);
}
_fd = -1;
}
Expand Down

0 comments on commit f5a1473

Please sign in to comment.