[master] 289cd3c Shift more general stuff from common.h to vdef.h

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 9 01:19:12 CET 2016


commit 289cd3cc7b2a52f2dd0e8f3a591ad7227825ac2b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 8 21:26:27 2016 +0000

    Shift more general stuff from common.h to vdef.h

diff --git a/bin/varnishd/common/common.h b/bin/varnishd/common/common.h
index 9f21257..e280282 100644
--- a/bin/varnishd/common/common.h
+++ b/bin/varnishd/common/common.h
@@ -40,8 +40,6 @@
 #include "vsb.h"
 #include "vapi/vsc_int.h"
 
-struct cli;
-
 /**********************************************************************/
 
 /* Name of transient storage */
@@ -78,30 +76,3 @@ void VSM_common_delete(struct vsm_sc **sc);
 void VSM_common_copy(struct vsm_sc *to, const struct vsm_sc *from);
 void VSM_common_cleaner(struct vsm_sc *sc, struct VSC_C_main *stats);
 void VSM_common_ageupdate(const struct vsm_sc *sc);
-
-/*---------------------------------------------------------------------
- * Generic power-2 rounding macros
- */
-
-#define PWR2(x)     ((((x)-1UL)&(x))==0)		/* Is a power of two */
-#define RDN2(x, y)  ((x)&(~((uintptr_t)(y)-1UL)))	/* PWR2(y) true */
-#define RUP2(x, y)  (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
-
-/*--------------------------------------------------------------------
- * Pointer alignment magic
- */
-
-#if defined(__sparc__)
-/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */
-#  define PALGN	    (sizeof(double) - 1)	/* size of alignment */
-#else
-#  define PALGN	    (sizeof(void *) - 1)	/* size of alignment */
-#endif
-#define PAOK(p)	    (((uintptr_t)(p) & PALGN) == 0)	/* is aligned */
-#define PRNDDN(p)   ((uintptr_t)(p) & ~PALGN)		/* Round down */
-#define PRNDUP(p)   (((uintptr_t)(p) + PALGN) & ~PALGN)	/* Round up */
-
-/*--------------------------------------------------------------------
- * To be used as little as possible to wash off const/volatile etc.
- */
-#define TRUST_ME(ptr)	((void*)(uintptr_t)(ptr))
diff --git a/include/vdef.h b/include/vdef.h
index bf5d3f4..3ec0608 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -67,6 +67,33 @@
 #  define __v_printflike(f,a)
 #endif
 
+/*********************************************************************
+ * Pointer alignment magic
+ */
+
+#if defined(__sparc__)
+/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */
+#  define PALGN	    (sizeof(double) - 1)	/* size of alignment */
+#else
+#  define PALGN	    (sizeof(void *) - 1)	/* size of alignment */
+#endif
+#define PAOK(p)	    (((uintptr_t)(p) & PALGN) == 0)	/* is aligned */
+#define PRNDDN(p)   ((uintptr_t)(p) & ~PALGN)		/* Round down */
+#define PRNDUP(p)   (((uintptr_t)(p) + PALGN) & ~PALGN)	/* Round up */
+
+/*********************************************************************
+ * To be used as little as possible to wash off const/volatile etc.
+ */
+#define TRUST_ME(ptr)	((void*)(uintptr_t)(ptr))
+
+/**********************************************************************
+ * Generic power-2 rounding macros
+ */
+
+#define PWR2(x)     ((((x)-1UL)&(x))==0)		/* Is a power of two */
+#define RDN2(x, y)  ((x)&(~((uintptr_t)(y)-1UL)))	/* PWR2(y) true */
+#define RUP2(x, y)  (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
+
 /**********************************************************************
  * FlexeLint and compiler shutuppery
  */



More information about the varnish-commit mailing list