aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-17 22:19:39 +0200
committerGitHub <noreply@github.com>2017-08-17 22:19:39 +0200
commit921151d97a2fb2238ab514324fb95e2732248b96 (patch)
tree0723ab1f2c4df22492b4c2221d2974020d4dfd3d /src/util
parentc738d1eeabbbe9164a25f6b69bc7ec1a3b44b051 (diff)
downloadminetest-921151d97a2fb2238ab514324fb95e2732248b96.tar.gz
minetest-921151d97a2fb2238ab514324fb95e2732248b96.tar.bz2
minetest-921151d97a2fb2238ab514324fb95e2732248b96.zip
C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
Diffstat (limited to 'src/util')
-rw-r--r--src/util/areastore.h5
-rw-r--r--src/util/auth.h5
-rw-r--r--src/util/base64.h24
-rw-r--r--src/util/basic_macros.h5
-rw-r--r--src/util/container.h6
-rw-r--r--src/util/directiontables.h5
-rw-r--r--src/util/enriched_string.h5
-rw-r--r--src/util/hex.h5
-rw-r--r--src/util/numeric.h5
-rw-r--r--src/util/pointedthing.h6
-rw-r--r--src/util/pointer.h6
-rw-r--r--src/util/serialize.h5
-rw-r--r--src/util/sha1.h6
-rw-r--r--src/util/sha2.h5
-rw-r--r--src/util/srp.h5
-rw-r--r--src/util/strfnd.h6
-rw-r--r--src/util/string.h6
-rw-r--r--src/util/thread.h6
-rw-r--r--src/util/timetaker.h6
19 files changed, 39 insertions, 83 deletions
diff --git a/src/util/areastore.h b/src/util/areastore.h
index 8c22c3ad7..e94aa4e2a 100644
--- a/src/util/areastore.h
+++ b/src/util/areastore.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef AREA_STORE_H_
-#define AREA_STORE_H_
+#pragma once
#include "irr_v3d.h"
#include "noise.h" // for PcgRandom
@@ -197,5 +196,3 @@ private:
};
#endif // USE_SPATIAL
-
-#endif // AREA_STORE_H_
diff --git a/src/util/auth.h b/src/util/auth.h
index 7cdc7d74d..ba827f322 100644
--- a/src/util/auth.h
+++ b/src/util/auth.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef AUTH_H
-#define AUTH_H
+#pragma once
/// Gets the base64 encoded legacy password db entry.
std::string translate_password(const std::string &name,
@@ -46,5 +45,3 @@ std::string encode_srp_verifier(const std::string &verifier,
/// and salt components.
bool decode_srp_verifier_and_salt(const std::string &encoded,
std::string *verifier, std::string *salt);
-
-#endif
diff --git a/src/util/base64.h b/src/util/base64.h
index 1cb175518..7f2bf1368 100644
--- a/src/util/base64.h
+++ b/src/util/base64.h
@@ -1,10 +1,26 @@
-#ifndef BASE64_HEADER
-#define BASE64_HEADER
+/*
+Minetest
+Copyright (C) 2013-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#pragma once
#include <string>
bool base64_is_valid(std::string const& s);
std::string base64_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s);
-
-#endif // BASE64_HEADER
diff --git a/src/util/basic_macros.h b/src/util/basic_macros.h
index 71be13a1f..334e342e0 100644
--- a/src/util/basic_macros.h
+++ b/src/util/basic_macros.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef BASICMACROS_HEADER
-#define BASICMACROS_HEADER
+#pragma once
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
@@ -57,5 +56,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
#define PP2(x) "("<<(x).X<<","<<(x).Y<<")"
-
-#endif
diff --git a/src/util/container.h b/src/util/container.h
index caaa1c328..af85d80e3 100644
--- a/src/util/container.h
+++ b/src/util/container.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_CONTAINER_HEADER
-#define UTIL_CONTAINER_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../exceptions.h"
@@ -301,6 +300,3 @@ private:
// we can't use std::deque here, because its iterators get invalidated
std::list<K> m_queue;
};
-
-#endif
-
diff --git a/src/util/directiontables.h b/src/util/directiontables.h
index 3cfe0fb3e..ab5b63217 100644
--- a/src/util/directiontables.h
+++ b/src/util/directiontables.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_DIRECTIONTABLES_HEADER
-#define UTIL_DIRECTIONTABLES_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../irr_v3d.h"
@@ -84,5 +83,3 @@ enum DirectionWallmounted {
DWM_ZP,
DWM_ZN,
};
-
-#endif
diff --git a/src/util/enriched_string.h b/src/util/enriched_string.h
index a3b8feb2a..202d84cb0 100644
--- a/src/util/enriched_string.h
+++ b/src/util/enriched_string.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef ENRICHEDSTRING_HEADER
-#define ENRICHEDSTRING_HEADER
+#pragma once
#include <string>
#include <vector>
@@ -87,5 +86,3 @@ private:
bool m_has_background = false;
irr::video::SColor m_background;
};
-
-#endif
diff --git a/src/util/hex.h b/src/util/hex.h
index c205d01da..df22539a5 100644
--- a/src/util/hex.h
+++ b/src/util/hex.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef HEX_HEADER
-#define HEX_HEADER
+#pragma once
#include <string>
@@ -57,5 +56,3 @@ static inline bool hex_digit_decode(char hexdigit, unsigned char &value)
return false;
return true;
}
-
-#endif
diff --git a/src/util/numeric.h b/src/util/numeric.h
index 5143c92e6..36e6fddd0 100644
--- a/src/util/numeric.h
+++ b/src/util/numeric.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_NUMERIC_HEADER
-#define UTIL_NUMERIC_HEADER
+#pragma once
#include "basic_macros.h"
#include "../irrlichttypes.h"
@@ -363,5 +362,3 @@ inline u32 npot2(u32 orig) {
orig |= orig >> 16;
return orig + 1;
}
-
-#endif
diff --git a/src/util/pointedthing.h b/src/util/pointedthing.h
index f63bcad9d..c13436fcd 100644
--- a/src/util/pointedthing.h
+++ b/src/util/pointedthing.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_POINTEDTHING_HEADER
-#define UTIL_POINTEDTHING_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../irr_v3d.h"
@@ -98,6 +97,3 @@ struct PointedThing
bool operator==(const PointedThing &pt2) const;
bool operator!=(const PointedThing &pt2) const;
};
-
-#endif
-
diff --git a/src/util/pointer.h b/src/util/pointer.h
index f68269882..f018efb20 100644
--- a/src/util/pointer.h
+++ b/src/util/pointer.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_POINTER_HEADER
-#define UTIL_POINTER_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../debug.h" // For assert()
@@ -227,6 +226,3 @@ inline SharedBuffer<u8> SharedBufferFromString(const char *string)
SharedBuffer<u8> b((u8*)string, strlen(string)+1);
return b;
}
-
-#endif
-
diff --git a/src/util/serialize.h b/src/util/serialize.h
index f43480557..0607ff37a 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_SERIALIZE_HEADER
-#define UTIL_SERIALIZE_HEADER
+#pragma once
#include "../irrlichttypes_bloated.h"
#include "../exceptions.h" // for SerializationError
@@ -657,5 +656,3 @@ inline void putRawData(std::vector<u8> *dest, const void *src, size_t len)
{
dest->insert(dest->end(), (u8 *)src, (u8 *)src + len);
}
-
-#endif
diff --git a/src/util/sha1.h b/src/util/sha1.h
index a55f94f44..20f89eae6 100644
--- a/src/util/sha1.h
+++ b/src/util/sha1.h
@@ -24,7 +24,8 @@ SOFTWARE.
*/
-#ifndef SHA1_HEADER
+#pragma once
+
typedef unsigned int Uint32;
class SHA1
@@ -51,6 +52,3 @@ public:
static void storeBigEndianUint32(unsigned char *byte, Uint32 num);
static void hexPrinter(unsigned char *c, int l);
};
-
-#define SHA1_HEADER
-#endif
diff --git a/src/util/sha2.h b/src/util/sha2.h
index 233c85a81..7d746262d 100644
--- a/src/util/sha2.h
+++ b/src/util/sha2.h
@@ -56,8 +56,7 @@
* [including the GNU Public Licence.]
*/
-#ifndef HEADER_SHA_H
-#define HEADER_SHA_H
+#pragma once
#include <stddef.h>
@@ -153,5 +152,3 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
#ifdef __cplusplus
}
#endif
-
-#endif
diff --git a/src/util/srp.h b/src/util/srp.h
index 2d49b076e..cf2bdec50 100644
--- a/src/util/srp.h
+++ b/src/util/srp.h
@@ -53,8 +53,7 @@
* hash & prime number pairings.
*/
-#ifndef SRP_H
-#define SRP_H
+#pragma once
struct SRPVerifier;
struct SRPUser;
@@ -190,5 +189,3 @@ void srp_user_process_challenge(struct SRPUser *usr,
/* bytes_HAMK must be exactly srp_user_get_session_key_length() bytes in size */
void srp_user_verify_session(struct SRPUser *usr, const unsigned char *bytes_HAMK);
-
-#endif /* Include Guard */
diff --git a/src/util/strfnd.h b/src/util/strfnd.h
index a7cd2badb..96cf1b458 100644
--- a/src/util/strfnd.h
+++ b/src/util/strfnd.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef STRFND_HEADER
-#define STRFND_HEADER
+#pragma once
#include <string>
@@ -77,6 +76,3 @@ public:
typedef BasicStrfnd<char> Strfnd;
typedef BasicStrfnd<wchar_t> WStrfnd;
-
-#endif
-
diff --git a/src/util/string.h b/src/util/string.h
index c0f4beefb..584ffb73a 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_STRING_HEADER
-#define UTIL_STRING_HEADER
+#pragma once
#include "irrlichttypes_bloated.h"
#include <stdlib.h>
@@ -648,6 +647,3 @@ inline const std::string duration_to_string(int sec)
return ss.str();
}
-
-
-#endif
diff --git a/src/util/thread.h b/src/util/thread.h
index 201d09a08..fbd04c08e 100644
--- a/src/util/thread.h
+++ b/src/util/thread.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_THREAD_HEADER
-#define UTIL_THREAD_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../threading/thread.h"
@@ -228,6 +227,3 @@ protected:
private:
Semaphore m_update_sem;
};
-
-#endif
-
diff --git a/src/util/timetaker.h b/src/util/timetaker.h
index 34564ee4b..2988e8133 100644
--- a/src/util/timetaker.h
+++ b/src/util/timetaker.h
@@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef UTIL_TIMETAKER_HEADER
-#define UTIL_TIMETAKER_HEADER
+#pragma once
#include "../irrlichttypes.h"
#include "../gettime.h"
@@ -49,6 +48,3 @@ private:
TimePrecision m_precision;
u64 *m_result = nullptr;
};
-
-#endif
-