summaryrefslogtreecommitdiff
path: root/src/common/utils.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-01-12 18:29:24 +0100
committerHaru <haru@dotalux.com>2015-01-12 18:35:36 +0100
commit4fa9fd843e19d041a6b142722e1f2c717a45f625 (patch)
tree5271cda69234c97a07a1ed9f2f6ef8510bdf94ac /src/common/utils.h
parentfe00cc320396bc7ac301a22592b718792ae49adf (diff)
downloadhercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.gz
hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.bz2
hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.xz
hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.zip
Blocked compilation of plugins that use unavailable functions
- Rather than failing at runtime, plugins that try to access non-interfaced, unavailable functions or variables, will now show an error at compile-time. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/utils.h')
-rw-r--r--src/common/utils.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/common/utils.h b/src/common/utils.h
index 421698d95..e6102f184 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -13,6 +13,10 @@
/* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */
#define HCACHE_KEY 'k'
+//Caps values to min/max
+#define cap_value(a, min, max) (((a) >= (max)) ? (max) : ((a) <= (min)) ? (min) : (a))
+
+#ifdef HERCULES_CORE
// generate a hex dump of the first 'length' bytes of 'buffer'
void WriteDump(FILE* fp, const void* buffer, size_t length);
void ShowDump(const void* buffer, size_t length);
@@ -20,9 +24,6 @@ void ShowDump(const void* buffer, size_t length);
void findfile(const char *p, const char *pat, void (func)(const char*));
bool exists(const char* filename);
-//Caps values to min/max
-#define cap_value(a, min, max) (((a) >= (max)) ? (max) : ((a) <= (min)) ? (min) : (a))
-
/// calculates the value of A / B, in percent (rounded down)
unsigned int get_percentage(const unsigned int A, const unsigned int B);
@@ -49,6 +50,7 @@ extern float GetFloat(const unsigned char* buf);
size_t hread(void * ptr, size_t size, size_t count, FILE * stream);
size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream);
+#endif // HERCULES_CORE
/* [Ind/Hercules] Caching */
struct HCache_interface {
@@ -63,6 +65,8 @@ struct HCache_interface {
struct HCache_interface *HCache;
+#ifdef HERCULES_CORE
void HCache_defaults(void);
+#endif // HERCULES_CORE
#endif /* COMMON_UTILS_H */