commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r802328 - in /commons/sandbox/runtime/trunk/src/main/native/include: acr.h acr_private.h
Date Sat, 08 Aug 2009 09:27:00 GMT
Author: mturk
Date: Sat Aug  8 09:26:53 2009
New Revision: 802328

URL: http://svn.apache.org/viewvc?rev=802328&view=rev
Log:
Put alignmen macros in acr.h

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr.h
    commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr.h?rev=802328&r1=802327&r2=802328&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr.h Sat Aug  8 09:26:53 2009
@@ -170,8 +170,13 @@
 /* JNI header */
 #include <jni.h>
 
-#ifdef __cplusplus
-extern "C" {
+#define ACR_OFFSET(T, F) \
+        ((long) (((char *) (&(((T) NULL)->F))) - ((char *) NULL)))
+
+#if defined(offsetof) && !defined(__cplusplus)
+#define ACR_OFFSETOF(T, F) offsetof(T, F)
+#else
+#define ACR_OFFSETOF(T, F) ACR_OFFSET(T*, F)
 #endif
 
 #ifdef __cplusplus
@@ -182,6 +187,8 @@
 #define ACR_END_DECLS
 #endif
 
+ACR_BEGIN_DECLS
+
 /* Typedefs that ACR needs. */
 typedef  unsigned char      acr_byte_t;
 typedef  short              acr_int16_t;
@@ -261,6 +268,14 @@
 
 #define ACR_SIZE_T_MAX      ((acr_size_t)~0 - 8192)
 
+/* ACR_ALIGN() is only to be used to align on a power of 2 boundary */
+#define ACR_ALIGN(size, boundary) \
+    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
+
+/** Default alignment */
+#define ACR_ALIGN_DEFAULT(size) ACR_ALIGN(size, 8)
+
+
 /**
  * ACR_DECLARE_EXPORT is defined when building the ANNEX dynamic library,
  * so that all public symbols are exported.
@@ -365,8 +380,6 @@
 
 #endif
 
-#ifdef __cplusplus
-}
-#endif
+ACR_END_DECLS
 #endif /* _ACR_H */
 

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=802328&r1=802327&r2=802328&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Sat Aug  8 09:26:53
2009
@@ -47,13 +47,6 @@
     JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_util_##CL##_##MN
 
 
-/* ACR_ALIGN() is only to be used to align on a power of 2 boundary */
-#define ACR_ALIGN(size, boundary) \
-    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
-
-/** Default alignment */
-#define ACR_ALIGN_DEFAULT(size) ACR_ALIGN(size, 8)
-
 /* undef min/max macros
  * They break our function names
  */



Mime
View raw message