]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
Make compiler and virtual-machine compile as C++ code, also removed gmqcc_voidptr...
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 3755a51384a1ee3cb0b2999d0630f418c6e04145..949559442021428f8555b8ce672dbb38c9d02330 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -260,40 +260,12 @@ size_t util_strtononcmd (const char *, char *, size_t);
 
 uint16_t util_crc16(uint16_t crc, const char *data, size_t len);
 
-/*
- * If we're compiling as C++ code we need to fix some subtle issues regarding casts between mem_a/mem_d
- * since C++ doesn't allow implicit conversions between void*
- */
-#ifdef __cplusplus
-        /*
-         * void * will be implicitally converted to gmqcc_voidptr using gmqcc_voidptr(void*).  This is what
-         * essentially allows us to allow implicit conversion to whatever pointer type we're trying to assign
-         * to because it acks as a default assignment constructor.
-         */
-        class gmqcc_voidptr {
-            void *m_pointer;
-        public:
-            gmqcc_voidptr(void *pointer) :
-                m_pointer(pointer)
-            { };
-
-            template <typename T>
-            GMQCC_INLINE operator T *() {
-                return m_pointer;
-            }
-        };
-
-#      define GMQCC_IMPLICIT_POINTER(X) (gmqcc_voidptr(X))
-#else
-#      define GMQCC_IMPLICIT_POINTER(X) (X)
-#endif
-
 #ifdef NOTRACK
-#    define mem_a(x)    GMQCC_IMPLICIT_POINTER(malloc (x))
+#    define mem_a(x)    malloc (x)
 #    define mem_d(x)    free   ((void*)x)
 #    define mem_r(x, n) realloc((void*)x, n)
 #else
-#    define mem_a(x)    GMQCC_IMPLICIT_POINTER(util_memory_a((x), __LINE__, __FILE__))
+#    define mem_a(x)    util_memory_a((x), __LINE__, __FILE__)
 #    define mem_d(x)    util_memory_d((void*)(x),      __LINE__, __FILE__)
 #    define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__)
 #endif
@@ -371,12 +343,12 @@ typedef struct hash_table_t {
  */
 hash_table_t *util_htnew (size_t size);
 void          util_htset (hash_table_t *ht, const char *key, void *value);
-void         *util_htget (hash_table_t *ht, const char *key);
 void          util_htdel (hash_table_t *ht);
 size_t        util_hthash(hash_table_t *ht, const char *key);
-void         *util_htgeth(hash_table_t *ht, const char *key, size_t hash);
 void          util_htseth(hash_table_t *ht, const char *key, size_t hash, void *value);
 
+void         *util_htget (hash_table_t *ht, const char *key);
+void         *util_htgeth(hash_table_t *ht, const char *key, size_t hash);
 /*===================================================================*/
 /*============================ file.c ===============================*/
 /*===================================================================*/