diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-01-21 10:34:13 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-01-21 10:59:47 +0100 |
commit | 6fff2b7cc37c35b38401018ed9f557ea2bd959fb (patch) | |
tree | 31dc4c6eb793964532e27dd5bbabaf95dd9b2bdf /src/utils | |
parent | 894eeb76c42ebcf0dc1be9da735f47543c7f6a3a (diff) | |
download | mana-master.tar.gz mana-master.tar.bz2 mana-master.tar.xz mana-master.zip |
Thanks to https://github.com/cgmb/guardonce and a follow-up replace to
remove duplicated newlines at end of file:
find src -type f -name '*.h' -exec \
sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \;
Source: https://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof
Fixes compile on macOS, which appears to have been due to the EVENT_H
include guard.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/base64.h | 5 | ||||
-rw-r--r-- | src/utils/copynpaste.h | 2 | ||||
-rw-r--r-- | src/utils/dtor.h | 5 | ||||
-rw-r--r-- | src/utils/gettext.h | 5 | ||||
-rw-r--r-- | src/utils/mathutils.h | 5 | ||||
-rw-r--r-- | src/utils/mkdir.h | 5 | ||||
-rw-r--r-- | src/utils/mutex.h | 5 | ||||
-rw-r--r-- | src/utils/path.h | 5 | ||||
-rw-r--r-- | src/utils/sha256.h | 5 | ||||
-rw-r--r-- | src/utils/specialfolder.h | 5 | ||||
-rw-r--r-- | src/utils/stringutils.h | 5 | ||||
-rw-r--r-- | src/utils/time.h | 5 | ||||
-rw-r--r-- | src/utils/xml.h | 5 | ||||
-rw-r--r-- | src/utils/zlib.h | 5 |
14 files changed, 15 insertions, 52 deletions
diff --git a/src/utils/base64.h b/src/utils/base64.h index 92c23016..8fc7e79f 100644 --- a/src/utils/base64.h +++ b/src/utils/base64.h @@ -27,10 +27,7 @@ +----------------------------------------------------------------------+ */ -#ifndef BASE64_H -#define BASE64_H +#pragma once extern unsigned char *php3_base64_encode(const unsigned char *, int, int *); extern unsigned char *php3_base64_decode(const unsigned char *, int, int *); - -#endif /* BASE64_H */ diff --git a/src/utils/copynpaste.h b/src/utils/copynpaste.h index b6aa0de0..83e48891 100644 --- a/src/utils/copynpaste.h +++ b/src/utils/copynpaste.h @@ -18,6 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#pragma once + #include <string> /** diff --git a/src/utils/dtor.h b/src/utils/dtor.h index 76c68725..79b374d0 100644 --- a/src/utils/dtor.h +++ b/src/utils/dtor.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_DTOR_H -#define UTILS_DTOR_H +#pragma once #include <algorithm> #include <utility> @@ -48,5 +47,3 @@ inline void delete_all(Container &c) { std::for_each(c.begin(), c.end(), make_dtor(c)); } - -#endif diff --git a/src/utils/gettext.h b/src/utils/gettext.h index f3b12ada..1f40a4be 100644 --- a/src/utils/gettext.h +++ b/src/utils/gettext.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_GETTEXT_H -#define UTILS_GETTEXT_H +#pragma once #ifdef HAVE_CONFIG_H #include "config.h" @@ -40,5 +39,3 @@ #define N_(s) ((char const *)s) #endif - -#endif // UTILS_GETTEXT_H diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index 21eba16f..0a169df5 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_MATHUTILS_H -#define UTILS_MATHUTILS_H +#pragma once /* A very fast function to calculate the approximate inverse square root of a * floating point value and a helper function that uses it for getting the @@ -57,5 +56,3 @@ inline float weightedAverage(float n1, float n2, float w) return w * n2 + (1.0f - w) * n1; } - -#endif // UTILS_MATHUTILS_H diff --git a/src/utils/mkdir.h b/src/utils/mkdir.h index 3bd76145..817c79df 100644 --- a/src/utils/mkdir.h +++ b/src/utils/mkdir.h @@ -18,9 +18,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MKDIR_H -#define MKDIR_H +#pragma once int mkdir_r(const char *pathname); - -#endif diff --git a/src/utils/mutex.h b/src/utils/mutex.h index b4661c70..3e01eb76 100644 --- a/src/utils/mutex.h +++ b/src/utils/mutex.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MUTEX_H -#define MUTEX_H +#pragma once #include "log.h" @@ -103,5 +102,3 @@ inline MutexLocker::~MutexLocker() if (mMutex) mMutex->unlock(); } - -#endif // MUTEX_H diff --git a/src/utils/path.h b/src/utils/path.h index 5338c74e..0b7019eb 100644 --- a/src/utils/path.h +++ b/src/utils/path.h @@ -18,8 +18,7 @@ * along with The Mana Server. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_PATH_H -#define UTILS_PATH_H +#pragma once #include <string> @@ -29,5 +28,3 @@ namespace utils std::string joinPaths(std::string_view path1, std::string_view path2); std::string cleanPath(const std::string &path); } - -#endif // UTILS_PATH_H diff --git a/src/utils/sha256.h b/src/utils/sha256.h index 8a9c2b70..6c2c3107 100644 --- a/src/utils/sha256.h +++ b/src/utils/sha256.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_SHA256_H -#define UTILS_SHA256_H +#pragma once #include <string> @@ -31,5 +30,3 @@ * @return the SHA-256 hash for the given string. */ std::string sha256(const std::string &string); - -#endif // UTILS_SHA256_H diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h index 36a4e0c1..9e069310 100644 --- a/src/utils/specialfolder.h +++ b/src/utils/specialfolder.h @@ -18,8 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SPECIALFOLDER_H -#define SPECIALFOLDER_H +#pragma once #ifdef _WIN32 #include <shlobj.h> @@ -31,5 +30,3 @@ std::string getSpecialFolderLocation(const KNOWNFOLDERID &folderId); #include <string> std::string getResourcesLocation(); #endif - -#endif diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index e7ff1332..8781a9c4 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_STRINGUTILS_H -#define UTILS_STRINGUTILS_H +#pragma once #include <optional> #include <sstream> @@ -221,5 +220,3 @@ std::string getHostNameFromURL(const std::string &url); * separator. */ std::string join(const std::vector<std::string> &strings, const char *separator); - -#endif // UTILS_STRINGUTILS_H diff --git a/src/utils/time.h b/src/utils/time.h index 58b8164a..590041e3 100644 --- a/src/utils/time.h +++ b/src/utils/time.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - #ifndef UTILS_TIME_H - #define UTILS_TIME_H +#pragma once #include <cstdint> @@ -107,5 +106,3 @@ public: private: uint32_t mTimeout = 0; }; - -#endif // UTILS_TIME_H diff --git a/src/utils/xml.h b/src/utils/xml.h index 13c06988..787504bb 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef XML_H -#define XML_H +#pragma once #include "utils/stringutils.h" @@ -295,5 +294,3 @@ namespace XML xmlTextWriterWriteString(mWriter, BAD_CAST text.c_str()); } } - -#endif // XML_H diff --git a/src/utils/zlib.h b/src/utils/zlib.h index 53dfd613..74853bd6 100644 --- a/src/utils/zlib.h +++ b/src/utils/zlib.h @@ -19,8 +19,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_ZLIB_H -#define UTILS_ZLIB_H +#pragma once #include <string> @@ -44,5 +43,3 @@ int inflateMemory(unsigned char *in, unsigned int inLength, * uncompressed, or <code>NULL</code> on fail. */ void *loadCompressedFile(const std::string &filename, int &filesize); - -#endif // UTILS_ZLIB_H |