Add CCAST for const cast.
authorChristos Zoulas <christos@zoulas.com>
Mon, 9 Nov 2015 21:03:42 +0000 (21:03 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 9 Nov 2015 21:03:42 +0000 (21:03 +0000)
src/file.h

index b0f0cc129c4e629dac5c933b3ec5bb4c2c9a6154..a71acd73cff930c25a522a69c30ceb8c16def083 100644 (file)
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.172 2015/09/11 17:24:09 christos Exp $
+ * @(#)$File: file.h,v 1.173 2015/11/09 21:03:42 christos Exp $
  */
 
 #ifndef __file_h__
@@ -365,9 +365,11 @@ struct mlist {
 #ifdef __cplusplus
 #define CAST(T, b)     static_cast<T>(b)
 #define RCAST(T, b)    reinterpret_cast<T>(b)
+#define CCAST(T, b)    const_cast<T>(b)
 #else
-#define CAST(T, b)     (T)(b)
-#define RCAST(T, b)    (T)(b)
+#define CAST(T, b)     ((T)(b))
+#define RCAST(T, b)    ((T)(b))
+#define CCAST(T, b)    ((T)(uintptr_t)(b))
 #endif
 
 struct level_info {