Revision: 55603
          http://sourceforge.net/p/brlcad/code/55603
Author:   brlcad
Date:     2013-05-30 05:33:57 +0000 (Thu, 30 May 2013)
Log Message:
-----------
make sure we don't cast away constness unnecessarily.  looks like gcc 4.4 has 
trouble parsing a const genptr_t but no problems with the const type overall, 
so we introduce a const_genptr_t type and use accordingly.

Modified Paths:
--------------
    brlcad/trunk/include/bu.h

Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h   2013-05-30 04:39:42 UTC (rev 55602)
+++ brlcad/trunk/include/bu.h   2013-05-30 05:33:57 UTC (rev 55603)
@@ -398,6 +398,7 @@
  */
 #if !defined(GENPTR_NULL)
 typedef void *genptr_t;
+typedef const void *const_genptr_t;
 #  define GENPTR_NULL ((genptr_t)0)
 #endif
 
@@ -688,9 +689,9 @@
 #  define BU_CKMAG(_ptr, _magic, _str) IGNORE((_ptr))
 #else
 #  define BU_CKMAG(_ptr, _magic, _str) { \
-       uintptr_t _ptrval = (uintptr_t)(_ptr); \
-       if (UNLIKELY((_ptrval == 0) || (_ptrval & (sizeof(_ptrval)-1)) || 
*((uint32_t *)(_ptr)) != (uint32_t)(_magic))) { \
-           bu_badmagic((uint32_t *)(_ptr), (uint32_t)_magic, _str, __FILE__, 
__LINE__); \
+       const uintptr_t _ptrval = (const uintptr_t)(_ptr); \
+       if (UNLIKELY((_ptrval == 0) || (_ptrval & (sizeof(_ptrval)-1)) || 
*((const uint32_t *)(_ptr)) != (uint32_t)(_magic))) { \
+           bu_badmagic((const uint32_t *)(_ptr), (uint32_t)_magic, _str, 
__FILE__, __LINE__); \
        } \
     }
 #endif
@@ -1910,7 +1911,7 @@
  *
  */
 #define BU_AVS_FOR(_pp, _avp) \
-    (_pp) = ((void *)(_avp) != (void *)NULL) ? ((_avp)->count > 0 ? 
&(_avp)->avp[(_avp)->count-1] : NULL) : NULL; ((void *)(_pp) != (void *)NULL) 
&& ((void *)(_avp) != (void *)NULL) && (_avp)->avp && (_pp) >= (_avp)->avp; 
(_pp)--
+    (_pp) = ((const void *)(_avp) != (const void *)NULL) ? ((_avp)->count > 0 
? &(_avp)->avp[(_avp)->count-1] : NULL) : NULL; ((const void *)(_pp) != (const 
void *)NULL) && ((const void *)(_avp) != (const void *)NULL) && (_avp)->avp && 
(_pp) >= (_avp)->avp; (_pp)--
 
 /**
  * Some (but not all) attribute name and value string pointers are
@@ -1919,8 +1920,9 @@
  * whether the pointer needs to be freed or not.
  */
 #define AVS_IS_FREEABLE(_avsp, _p)     \
-    ((_avsp)->readonly_max == NULL ||  \
-     ((genptr_t)(_p) < (genptr_t)(_avsp)->readonly_min || (genptr_t)(_p) > 
(genptr_t)(_avsp)->readonly_max))
+    ((_avsp)->readonly_max == NULL \
+     || (const_genptr_t)(_p) < (_avsp)->readonly_min \
+     || (const_genptr_t)(_p) > (_avsp)->readonly_max)
 
 /** @} */
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to