From 309a2f9fbd82f5acdcd969dac089b06aa5ad86a6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 1 May 2017 15:34:26 +0300 Subject: service: code style --- um/service/include/libservice/device.hpp | 14 ++++++++---- um/service/include/libservice/handle.hpp | 12 +++++++--- um/service/include/libservice/service.hpp | 14 ++++++++---- um/service/include/libservice/service_handle.hpp | 14 ++++++++---- um/service/include/libservice/service_manager.hpp | 14 ++++++++---- um/service/src/device.cpp | 17 -------------- um/service/src/handle.cpp | 27 ----------------------- um/service/src/service.cpp | 18 --------------- um/service/src/service_handle.cpp | 27 ----------------------- um/service/src/service_manager.cpp | 19 +--------------- 10 files changed, 50 insertions(+), 126 deletions(-) delete mode 100644 um/service/src/handle.cpp delete mode 100644 um/service/src/service_handle.cpp (limited to 'um') diff --git a/um/service/include/libservice/device.hpp b/um/service/include/libservice/device.hpp index ac292c8..f61c59a 100644 --- a/um/service/include/libservice/device.hpp +++ b/um/service/include/libservice/device.hpp @@ -63,13 +63,19 @@ namespace libservice Device(const Device&) = delete; }; - void swap(Device&, Device&) LIBSERVICE_NOEXCEPT; + inline void swap(Device& a, Device& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } namespace std { template <> - void swap( - libservice::Device&, - libservice::Device&) LIBSERVICE_NOEXCEPT; + inline void swap( + libservice::Device& a, + libservice::Device& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } diff --git a/um/service/include/libservice/handle.hpp b/um/service/include/libservice/handle.hpp index 5e351d2..abd1d5a 100644 --- a/um/service/include/libservice/handle.hpp +++ b/um/service/include/libservice/handle.hpp @@ -65,13 +65,19 @@ namespace libservice Handle(const Handle&) = delete; }; - void swap(Handle& a, Handle& b) LIBSERVICE_NOEXCEPT; + inline void swap(Handle& a, Handle& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } namespace std { template <> - void swap( + inline void swap( libservice::Handle& a, - libservice::Handle& b) LIBSERVICE_NOEXCEPT; + libservice::Handle& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } diff --git a/um/service/include/libservice/service.hpp b/um/service/include/libservice/service.hpp index 089f790..ca01ab4 100644 --- a/um/service/include/libservice/service.hpp +++ b/um/service/include/libservice/service.hpp @@ -61,13 +61,19 @@ namespace libservice Service(const Service&) = delete; }; - void swap(Service&, Service&) LIBSERVICE_NOEXCEPT; + inline void swap(Service& a, Service& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } namespace std { template <> - void swap( - libservice::Service&, - libservice::Service&) LIBSERVICE_NOEXCEPT; + inline void swap( + libservice::Service& a, + libservice::Service& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } diff --git a/um/service/include/libservice/service_handle.hpp b/um/service/include/libservice/service_handle.hpp index 2883ff3..52e37f4 100644 --- a/um/service/include/libservice/service_handle.hpp +++ b/um/service/include/libservice/service_handle.hpp @@ -64,13 +64,19 @@ namespace libservice ServiceHandle(const ServiceHandle&) = delete; }; - void swap(ServiceHandle&, ServiceHandle&) LIBSERVICE_NOEXCEPT; + inline void swap(ServiceHandle& a, ServiceHandle& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } namespace std { template <> - void swap( - libservice::ServiceHandle&, - libservice::ServiceHandle&) LIBSERVICE_NOEXCEPT; + inline void swap( + libservice::ServiceHandle& a, + libservice::ServiceHandle& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } diff --git a/um/service/include/libservice/service_manager.hpp b/um/service/include/libservice/service_manager.hpp index 80e6f12..3d4fe3a 100644 --- a/um/service/include/libservice/service_manager.hpp +++ b/um/service/include/libservice/service_manager.hpp @@ -51,13 +51,19 @@ namespace libservice ServiceManager(const ServiceManager&) = delete; }; - void swap(ServiceManager& a, ServiceManager& b) LIBSERVICE_NOEXCEPT; + inline void swap(ServiceManager& a, ServiceManager& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } namespace std { template <> - void swap( - libservice::ServiceManager&, - libservice::ServiceManager&) LIBSERVICE_NOEXCEPT; + inline void swap( + libservice::ServiceManager& a, + libservice::ServiceManager& b) LIBSERVICE_NOEXCEPT + { + a.swap(b); + } } diff --git a/um/service/src/device.cpp b/um/service/src/device.cpp index 1bdb42f..f1ecccb 100644 --- a/um/service/src/device.cpp +++ b/um/service/src/device.cpp @@ -13,7 +13,6 @@ #include #include #include -#include namespace libservice { @@ -117,20 +116,4 @@ namespace libservice return nbwritten; } - - void swap(Device& a, Device& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} - -namespace std -{ - template <> - void swap( - libservice::Device& a, - libservice::Device& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } } diff --git a/um/service/src/handle.cpp b/um/service/src/handle.cpp deleted file mode 100644 index 7567781..0000000 --- a/um/service/src/handle.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015 Egor Tensin -// This file is part of the "Windows 7 drivers" project. -// For details, see https://github.com/egor-tensin/windows7-drivers. -// Distributed under the MIT License. - -#include "libservice/all.hpp" - -#include - -namespace libservice -{ - void swap(Handle& a, Handle& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} - -namespace std -{ - template <> - void swap( - libservice::Handle& a, - libservice::Handle& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} diff --git a/um/service/src/service.cpp b/um/service/src/service.cpp index 8b5e043..1cdfe71 100644 --- a/um/service/src/service.cpp +++ b/um/service/src/service.cpp @@ -9,8 +9,6 @@ #include #include -#include -#include namespace libservice { @@ -257,20 +255,4 @@ namespace libservice stop(); uninstall_service(handle); } - - void swap(Service& a, Service& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} - -namespace std -{ - template <> - void swap( - libservice::Service& a, - libservice::Service& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } } diff --git a/um/service/src/service_handle.cpp b/um/service/src/service_handle.cpp deleted file mode 100644 index adce7f0..0000000 --- a/um/service/src/service_handle.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015 Egor Tensin -// This file is part of the "Windows 7 drivers" project. -// For details, see https://github.com/egor-tensin/windows7-drivers. -// Distributed under the MIT License. - -#include "libservice/all.hpp" - -#include - -namespace libservice -{ - void swap(ServiceHandle& a, ServiceHandle& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} - -namespace std -{ - template <> - void swap( - libservice::ServiceHandle& a, - libservice::ServiceHandle& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} diff --git a/um/service/src/service_manager.cpp b/um/service/src/service_manager.cpp index 61662de..530976c 100644 --- a/um/service/src/service_manager.cpp +++ b/um/service/src/service_manager.cpp @@ -8,13 +8,12 @@ #include #include -#include namespace libservice { ServiceManager ServiceManager::open() { - SC_HANDLE raw = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + const auto raw = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if (NULL == raw) { @@ -25,20 +24,4 @@ namespace libservice return ServiceHandle(raw); } - - void swap(ServiceManager& a, ServiceManager& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } -} - -namespace std -{ - template <> - void swap( - libservice::ServiceManager& a, - libservice::ServiceManager& b) LIBSERVICE_NOEXCEPT - { - a.swap(b); - } } -- cgit v1.2.3