| 2616 | inline const char *mmap::data() const { return (const char *)addr_; } |
| 2617 | |
| 2618 | inline void mmap::close() { |
| 2619 | #if defined(_WIN32) |
| 2620 | if (addr_) { |
| 2621 | ::UnmapViewOfFile(addr_); |
| 2622 | addr_ = nullptr; |
| 2623 | } |
| 2624 | |
| 2625 | if (hMapping_) { |
| 2626 | ::CloseHandle(hMapping_); |
| 2627 | hMapping_ = NULL; |
| 2628 | } |
| 2629 | |
| 2630 | if (hFile_ != INVALID_HANDLE_VALUE) { |
| 2631 | ::CloseHandle(hFile_); |
| 2632 | hFile_ = INVALID_HANDLE_VALUE; |
| 2633 | } |
| 2634 | #else |
| 2635 | if (addr_ != nullptr) { |
| 2636 | munmap(addr_, size_); |
| 2637 | addr_ = nullptr; |
| 2638 | } |
| 2639 | |
| 2640 | if (fd_ != -1) { |
| 2641 | ::close(fd_); |
| 2642 | fd_ = -1; |
| 2643 | } |
| 2644 | #endif |
| 2645 | size_ = 0; |
| 2646 | } |
| 2647 | inline int close_socket(socket_t sock) { |
| 2648 | #ifdef _WIN32 |
| 2649 | return closesocket(sock); |
no outgoing calls
no test coverage detected