From: PHO <pho@cielonegro.org>
Date: Sun, 19 Sep 2010 03:04:48 +0000 (+0900)
Subject: C string macros should be treated as global arrays.
X-Git-Tag: RELEASE-0.1^0
X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;p=bindings-apr.git

C string macros should be treated as global arrays.
---

diff --git a/Bindings/APR.hsc b/Bindings/APR.hsc
index 4913ba2..24d056a 100644
--- a/Bindings/APR.hsc
+++ b/Bindings/APR.hsc
@@ -4,7 +4,7 @@
 module Bindings.APR where
 #strict_import
 
-{- I'm not sure if these are really useful... (PHO)
+{- I'm not sure if these are really helpful... (PHO)
  -}
 #num APR_HAS_INLINE
 
@@ -163,18 +163,18 @@ module Bindings.APR where
 #num APR_UINT64_MAX
 #num APR_SIZE_MAX
 
-#pointer APR_SSIZE_T_FMT
-#pointer APR_SIZE_T_FMT
-#pointer APR_OFF_T_FMT
-#pointer APR_PID_T_FMT
-#pointer APR_INT64_T_FMT
-#pointer APR_UINT64_T_FMT
-#pointer APR_UINT64_T_HEX_FMT
+#globalarray APR_SSIZE_T_FMT     , CChar
+#globalarray APR_SIZE_T_FMT      , CChar
+#globalarray APR_OFF_T_FMT       , CChar
+#globalarray APR_PID_T_FMT       , CChar
+#globalarray APR_INT64_T_FMT     , CChar
+#globalarray APR_UINT64_T_FMT    , CChar
+#globalarray APR_UINT64_T_HEX_FMT, CChar
 #num APR_PROC_MUTEX_IS_GLOBAL
-#pointer APR_EOL_STR
+#globalarray APR_EOL_STR         , CChar
 
 #opaque_t apr_wait_t
 
 #num APR_PATH_MAX
 
-#pointer APR_DSOPATH
+#globalarray APR_DSOPATH, CChar
diff --git a/Bindings/APR/Network/IO.hsc b/Bindings/APR/Network/IO.hsc
index febaf5e..2928e89 100644
--- a/Bindings/APR/Network/IO.hsc
+++ b/Bindings/APR/Network/IO.hsc
@@ -14,7 +14,7 @@ import Bindings.APR.Want
 
 #num APR_MAX_SECS_TO_LINGER
 #num APRMAXHOSTLEN
-#pointer APR_ANYADDR
+#globalarray APR_ANYADDR, CChar
 
 #num APR_SO_LINGER
 #num APR_SO_KEEPALIVE
diff --git a/Bindings/APR/Time.hsc b/Bindings/APR/Time.hsc
index a894523..2383647 100644
--- a/Bindings/APR/Time.hsc
+++ b/Bindings/APR/Time.hsc
@@ -11,7 +11,7 @@ import Bindings.APR.Pools
 #globalvar apr_day_snames  , Ptr (Ptr CChar)
 
 #integral_t apr_time_t
-#pointer APR_TIME_T_FMT
+#globalarray APR_TIME_T_FMT, CChar
 
 #integral_t apr_interval_time_t
 #integral_t apr_short_interval_time_t
diff --git a/Bindings/APR/Version.hsc b/Bindings/APR/Version.hsc
index 6f00153..30df2ab 100644
--- a/Bindings/APR/Version.hsc
+++ b/Bindings/APR/Version.hsc
@@ -10,8 +10,7 @@ module Bindings.APR.Version where
 
 #cinline APR_VERSION_AT_LEAST, CInt -> CInt -> CInt -> IO CInt
 
-#pointer APR_IS_DEV_STRING
-#pointer APR_VERSION_STRING
+#globalarray APR_VERSION_STRING, CChar
 
 #if !defined(APR_VERSION_ONLY)
 
diff --git a/bindings-apr.cabal b/bindings-apr.cabal
index 4b18e60..60bbfe4 100644
--- a/bindings-apr.cabal
+++ b/bindings-apr.cabal
@@ -66,12 +66,14 @@ Library
         Bindings.APR.Want
 
     C-Sources:
+        cbits/helper_apr.c
         cbits/helper_apr_errno.c
         cbits/helper_apr_general.c
         cbits/helper_apr_global_mutex.c
         cbits/helper_apr_pools.c
         cbits/helper_apr_lib.c
         cbits/helper_apr_mmap.c
+        cbits/helper_apr_network_io.c
         cbits/helper_apr_portable.c
         cbits/helper_apr_signal.c
         cbits/helper_apr_time.c
diff --git a/cbits/helper_apr.c b/cbits/helper_apr.c
new file mode 100644
index 0000000..b80cbaf
--- /dev/null
+++ b/cbits/helper_apr.c
@@ -0,0 +1,13 @@
+#include <bindings.cmacros.h>
+#include <apr.h>
+
+BC_GLOBALARRAY(APR_SSIZE_T_FMT     , char)
+BC_GLOBALARRAY(APR_SIZE_T_FMT      , char)
+BC_GLOBALARRAY(APR_OFF_T_FMT       , char)
+BC_GLOBALARRAY(APR_PID_T_FMT       , char)
+BC_GLOBALARRAY(APR_INT64_T_FMT     , char)
+BC_GLOBALARRAY(APR_UINT64_T_FMT    , char)
+BC_GLOBALARRAY(APR_UINT64_T_HEX_FMT, char)
+
+BC_GLOBALARRAY(APR_EOL_STR         , char)
+BC_GLOBALARRAY(APR_DSOPATH         , char)
diff --git a/cbits/helper_apr_network_io.c b/cbits/helper_apr_network_io.c
new file mode 100644
index 0000000..9e6ea00
--- /dev/null
+++ b/cbits/helper_apr_network_io.c
@@ -0,0 +1,4 @@
+#include <bindings.cmacros.h>
+#include <apr_network_io.h>
+
+BC_GLOBALARRAY(APR_ANYADDR, char)
diff --git a/cbits/helper_apr_time.c b/cbits/helper_apr_time.c
index 9c22ba6..6adb6cf 100644
--- a/cbits/helper_apr_time.c
+++ b/cbits/helper_apr_time.c
@@ -1,6 +1,8 @@
 #include <bindings.cmacros.h>
 #include <apr_time.h>
 
+BC_GLOBALARRAY(APR_TIME_T_FMT, char)
+
 BC_INLINE1(apr_time_sec , apr_time_t, apr_time_t)
 BC_INLINE1(apr_time_usec, apr_time_t, apr_time_t)
 BC_INLINE1(apr_time_msec, apr_time_t, apr_time_t)
diff --git a/cbits/helper_apr_version.c b/cbits/helper_apr_version.c
index add2bdf..4ad07f8 100644
--- a/cbits/helper_apr_version.c
+++ b/cbits/helper_apr_version.c
@@ -2,3 +2,5 @@
 #include <apr_version.h>
 
 BC_INLINE3(APR_VERSION_AT_LEAST, int, int, int, int)
+
+BC_GLOBALARRAY(APR_VERSION_STRING, char)