From e44b5c79c39d8319a3224de03ed9512a48c19234 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Wed, 14 Sep 2022 09:55:51 +0200 Subject: [PATCH] Removed comment header and global scope operators --- plugin.hpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/plugin.hpp b/plugin.hpp index bbfc727..6f4b9a5 100644 --- a/plugin.hpp +++ b/plugin.hpp @@ -1,11 +1,3 @@ -// -// plugin.hpp -// plugins -// -// Created by Bob Polis at 2019-06-09 -// Copyright (c) 2019 SwiftCoder. All rights reserved. -// - #ifndef _plugin_H_ #define _plugin_H_ @@ -25,10 +17,10 @@ namespace sc { class plugin { public: static void scan_plugins(const std::string& dir, const std::string& ext) { - DIR* plugins_dir = ::opendir(dir.c_str()); + DIR* plugins_dir = opendir(dir.c_str()); throw_if_null_msg(plugins_dir, (dir + " could not be opened").c_str()); struct dirent* info; - while ((info = ::readdir(plugins_dir)) != nullptr) { + while ((info = readdir(plugins_dir)) != nullptr) { if (info->d_name[0] != '.') { std::string plugname {info->d_name}; std::string::size_type lastdot = plugname.rfind("."); @@ -39,7 +31,7 @@ namespace sc { } } } - throw_if_min1(::closedir(plugins_dir)); + throw_if_min1(closedir(plugins_dir)); } using processor = std::function; @@ -64,12 +56,12 @@ namespace sc { static size_t count() { return plugins.size(); } plugin(const std::string& path) : _path {path} { - _plugin = ::dlopen(path.c_str(), RTLD_LAZY); + _plugin = dlopen(path.c_str(), RTLD_LAZY); - const char* err {::dlerror()}; + const char* err {dlerror()}; if (err) std::cerr << err << '\n'; if (_plugin) { - _factory = reinterpret_cast(::dlsym(_plugin, "create_instance")); + _factory = reinterpret_cast(dlsym(_plugin, "create_instance")); if (!_factory) { std::cerr << "create_instance() function not found in " << path << '\n'; } @@ -78,7 +70,7 @@ namespace sc { ~plugin() { if (_plugin) { - ::dlclose(_plugin); + dlclose(_plugin); _plugin = nullptr; } }