couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: Use a single conditional for a typedef
Date Mon, 27 Feb 2012 17:44:05 GMT
Updated Branches:
  refs/heads/R15B-driver b33ce0fac -> b1af764b1 (forced update)


Use a single conditional for a typedef

Erlang R15B redefines the signature for the driver control callback to
use its own special ssize_t type. This just adds a conditional based on
the definition of ERL_DRV_EXTENDED_MAJOR_VERSION to pick the right type.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b1af764b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b1af764b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b1af764b

Branch: refs/heads/R15B-driver
Commit: b1af764b106d52f2ed8a5f874bba5ed7fddee455
Parents: bc5a355
Author: Paul Joseph Davis <davisp@apache.org>
Authored: Mon Feb 27 11:34:13 2012 -0600
Committer: Paul Joseph Davis <davisp@apache.org>
Committed: Mon Feb 27 11:43:53 2012 -0600

----------------------------------------------------------------------
 src/couchdb/priv/icu_driver/couch_icu_driver.c |   27 +++++++++----------
 1 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b1af764b/src/couchdb/priv/icu_driver/couch_icu_driver.c
----------------------------------------------------------------------
diff --git a/src/couchdb/priv/icu_driver/couch_icu_driver.c b/src/couchdb/priv/icu_driver/couch_icu_driver.c
index 145c714..a59e8cb 100644
--- a/src/couchdb/priv/icu_driver/couch_icu_driver.c
+++ b/src/couchdb/priv/icu_driver/couch_icu_driver.c
@@ -30,6 +30,12 @@ specific language governing permissions and limitations under the License.
 #include <string.h> /* for memcpy */
 #endif
 
+#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2
+typedef int COUCH_SSIZET;
+#else
+typedef ErlDrvSSizeT COUCH_SSIZET;
+#endif
+
 typedef struct {
     ErlDrvPort port;
     UCollator* collNoCase;
@@ -79,13 +85,9 @@ static ErlDrvData couch_drv_start(ErlDrvPort port, char *buff)
     return (ErlDrvData)pData;
 }
 
-#if ERL_DRV_EXTENDED_MAJOR_VERSION == 1
-// < R15B
-int return_control_result(void* pLocalResult, int localLen, char **ppRetBuf, int returnLen)
-#else
-// >= R15B
-ErlDrvSSizeT return_control_result(void* pLocalResult, int localLen, char **ppRetBuf, ErlDrvSizeT
returnLen)
-#endif
+COUCH_SSIZET
+return_control_result(void* pLocalResult, int localLen,
+            char **ppRetBuf, COUCH_SSIZET returnLen)
 {
     if (*ppRetBuf == NULL || localLen > returnLen) {
         *ppRetBuf = (char*)driver_alloc_binary(localLen);
@@ -97,13 +99,10 @@ ErlDrvSSizeT return_control_result(void* pLocalResult, int localLen, char
**ppRe
     return localLen;
 }
 
-#if ERL_DRV_EXTENDED_MAJOR_VERSION == 1
-// < R15B
-static int couch_drv_control(ErlDrvData drv_data, unsigned int command, char *pBuf, int bufLen,
char **rbuf, int rlen)
-#else
-// >= R15B
-ErlDrvSSizeT couch_drv_control(ErlDrvData drv_data, unsigned int command, char *pBuf, ErlDrvSizeT
bufLen, char **rbuf, ErlDrvSizeT rlen)
-#endif
+static COUCH_SSIZET
+couch_drv_control(ErlDrvData drv_data, unsigned int command,
+        char *pBuf, COUCH_SSIZET bufLen,
+        char **rbuf, COUCH_SSIZET rlen)
 {
 
     couch_drv_data* pData = (couch_drv_data*)drv_data;


Mime
View raw message