From f5a14739fa33375edab7043bfeb980fa5269249c Mon Sep 17 00:00:00 2001 From: Mark Diekhans Date: Sat, 11 May 2019 13:20:44 -0700 Subject: [PATCH] reinserted some coding style notes --- CODING_STYLE.txt | 3 +++ api/mmap_impl/mmapFile.cpp | 17 ++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/CODING_STYLE.txt b/CODING_STYLE.txt index 0238c8d5..c57c710d 100644 --- a/CODING_STYLE.txt +++ b/CODING_STYLE.txt @@ -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 diff --git a/api/mmap_impl/mmapFile.cpp b/api/mmap_impl/mmapFile.cpp index 2d6b1691..87b6d1e1 100644 --- a/api/mmap_impl/mmapFile.cpp +++ b/api/mmap_impl/mmapFile.cpp @@ -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; } @@ -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; } @@ -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; }