Browse Source

ZOOKEEPER-1591. Windows build is broken because inttypes.h doesn't exist
(Marshall McMullen via michim)


git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1415847 13f79535-47bb-0310-9956-ffa450edef68

Michi Mutsuzaki 12 years ago
parent
commit
05acd0a720
5 changed files with 42 additions and 38 deletions
  1. 3 0
      CHANGES.txt
  2. 1 4
      src/c/include/recordio.h
  3. 0 2
      src/c/src/addrvec.h
  4. 20 14
      src/c/src/recordio.c
  5. 18 18
      src/c/src/zookeeper.c

+ 3 - 0
CHANGES.txt

@@ -270,6 +270,9 @@ BUGFIXES:
   ZOOKEEPER-1474. Cannot build Zookeeper with IBM Java: use of Sun
   MXBean classes (Adalberto Medeiros via phunt)
 
+  ZOOKEEPER-1591. Windows build is broken because inttypes.h doesn't exist
+  (Marshall McMullen via michim)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

+ 1 - 4
src/c/include/recordio.h

@@ -19,10 +19,7 @@
 #define __RECORDIO_H__
 
 #include <sys/types.h>
-#ifndef WIN32
-#define STRUCT_INITIALIZER(l,r) .l = r
-#else
-#define STRUCT_INITIALIZER(l,r)  r
+#ifdef WIN32
 #include "winconfig.h"
 #endif
 

+ 0 - 2
src/c/src/addrvec.h

@@ -19,8 +19,6 @@
 #ifndef ADDRVEC_H_
 #define ADDRVEC_H_
 
-#include <inttypes.h>
-
 #ifndef WIN32
 #include <sys/types.h>
 #include <sys/socket.h>

+ 20 - 14
src/c/src/recordio.c

@@ -278,21 +278,27 @@ int ia_deserialize_string(struct iarchive *ia, const char *name, char **s)
     return 0;
 }
 
-static struct iarchive ia_default = { STRUCT_INITIALIZER (start_record ,ia_start_record),
-        STRUCT_INITIALIZER (end_record ,ia_end_record), STRUCT_INITIALIZER (start_vector , ia_start_vector),
-        STRUCT_INITIALIZER (end_vector ,ia_end_vector), STRUCT_INITIALIZER (deserialize_Bool , ia_deserialize_bool),
-        STRUCT_INITIALIZER (deserialize_Int ,ia_deserialize_int),
-        STRUCT_INITIALIZER (deserialize_Long , ia_deserialize_long) ,
-        STRUCT_INITIALIZER (deserialize_Buffer, ia_deserialize_buffer),
-        STRUCT_INITIALIZER (deserialize_String, ia_deserialize_string)   };
+static struct iarchive ia_default = {
+        ia_start_record,
+        ia_end_record,
+        ia_start_vector,
+        ia_end_vector,
+        ia_deserialize_bool,
+        ia_deserialize_int,
+        ia_deserialize_long ,
+        ia_deserialize_buffer,
+        ia_deserialize_string};
 
-static struct oarchive oa_default = { STRUCT_INITIALIZER (start_record , oa_start_record),
-        STRUCT_INITIALIZER (end_record , oa_end_record), STRUCT_INITIALIZER (start_vector , oa_start_vector),
-        STRUCT_INITIALIZER (end_vector , oa_end_vector), STRUCT_INITIALIZER (serialize_Bool , oa_serialize_bool),
-        STRUCT_INITIALIZER (serialize_Int , oa_serialize_int),
-        STRUCT_INITIALIZER (serialize_Long , oa_serialize_long) ,
-        STRUCT_INITIALIZER (serialize_Buffer , oa_serialize_buffer),
-        STRUCT_INITIALIZER (serialize_String , oa_serialize_string) };
+static struct oarchive oa_default = {
+        oa_start_record,
+        oa_end_record,
+        oa_start_vector,
+        oa_end_vector,
+        oa_serialize_bool,
+        oa_serialize_int,
+        oa_serialize_long ,
+        oa_serialize_buffer,
+        oa_serialize_string};
 
 struct iarchive *create_buffer_iarchive(char *buffer, int len)
 {

+ 18 - 18
src/c/src/zookeeper.c

@@ -1620,7 +1620,7 @@ static void auth_completion_func(int rc, zhandle_t* zh)
 
 static int send_info_packet(zhandle_t *zh, auth_info* auth) {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid , AUTH_XID), STRUCT_INITIALIZER(type , ZOO_SETAUTH_OP)};
+    struct RequestHeader h = {AUTH_XID, ZOO_SETAUTH_OP};
     struct AuthPacket req;
     int rc;
     oa = create_buffer_oarchive();
@@ -1688,7 +1688,7 @@ static void free_key_list(char **list, int count)
 static int send_set_watches(zhandle_t *zh)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid , SET_WATCHES_XID), STRUCT_INITIALIZER(type , ZOO_SETWATCHES_OP)};
+    struct RequestHeader h = {SET_WATCHES_XID, ZOO_SETWATCHES_OP};
     struct SetWatches req;
     int rc;
 
@@ -1842,7 +1842,7 @@ static struct timeval get_timeval(int interval)
  {
     int rc;
     struct oarchive *oa = create_buffer_oarchive();
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid ,PING_XID), STRUCT_INITIALIZER (type , ZOO_PING_OP) };
+    struct RequestHeader h = {PING_XID, ZOO_PING_OP};
 
     rc = serialize_RequestHeader(oa, "header", &h);
     enter_critical(zh);
@@ -2311,7 +2311,7 @@ static int deserialize_multi(int xid, completion_list_t *cptr, struct iarchive *
 {
     int rc = 0;
     completion_head_t *clist = &cptr->c.clist;
-    struct MultiHeader mhdr = { STRUCT_INITIALIZER(type , 0), STRUCT_INITIALIZER(done , 0), STRUCT_INITIALIZER(err , 0) };
+    struct MultiHeader mhdr = {0, 0, 0};
     assert(clist);
     deserialize_MultiHeader(ia, "multiheader", &mhdr);
     while (!mhdr.done) {
@@ -2850,7 +2850,7 @@ int zookeeper_close(zhandle_t *zh)
      * destroy the handle later. */
     if(zh->state==ZOO_CONNECTED_STATE){
         struct oarchive *oa;
-        struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_CLOSE_OP)};
+        struct RequestHeader h = {get_xid(), ZOO_CLOSE_OP};
         LOG_INFO(("Closing zookeeper sessionId=%#llx to [%s]\n",
                 zh->client_id.client_id,zoo_get_current_server(zh)));
         oa = create_buffer_oarchive();
@@ -2976,7 +2976,7 @@ int zoo_awget(zhandle_t *zh, const char *path,
 {
     struct oarchive *oa;
     char *server_path = prepend_string(zh, path);
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type ,ZOO_GETDATA_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_GETDATA_OP};
     struct GetDataRequest req =  { (char*)server_path, watcher!=0 };
     int rc;
 
@@ -3028,7 +3028,7 @@ int zoo_aset(zhandle_t *zh, const char *path, const char *buffer, int buflen,
         int version, stat_completion_t dc, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_SETDATA_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_SETDATA_OP};
     struct SetDataRequest req;
     int rc = SetDataRequest_init(zh, &req, path, buffer, buflen, version);
     if (rc != ZOK) {
@@ -3082,7 +3082,7 @@ int zoo_acreate(zhandle_t *zh, const char *path, const char *value,
         string_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type ,ZOO_CREATE_OP) };
+    struct RequestHeader h = {get_xid(), ZOO_CREATE_OP};
     struct CreateRequest req;
 
     int rc = CreateRequest_init(zh, &req, 
@@ -3124,7 +3124,7 @@ int zoo_adelete(zhandle_t *zh, const char *path, int version,
         void_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_DELETE_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_DELETE_OP};
     struct DeleteRequest req;
     int rc = DeleteRequest_init(zh, &req, path, version);
     if (rc != ZOK) {
@@ -3160,7 +3160,7 @@ int zoo_awexists(zhandle_t *zh, const char *path,
         stat_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid ,get_xid()), STRUCT_INITIALIZER (type , ZOO_EXISTS_OP) };
+    struct RequestHeader h = {get_xid(), ZOO_EXISTS_OP};
     struct ExistsRequest req;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -3194,7 +3194,7 @@ static int zoo_awget_children_(zhandle_t *zh, const char *path,
          const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_GETCHILDREN_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_GETCHILDREN_OP};
     struct GetChildrenRequest req ;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -3242,7 +3242,7 @@ static int zoo_awget_children2_(zhandle_t *zh, const char *path,
 {
     /* invariant: (sc == NULL) != (sc == NULL) */
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER( xid, get_xid()), STRUCT_INITIALIZER (type ,ZOO_GETCHILDREN2_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_GETCHILDREN2_OP};
     struct GetChildren2Request req ;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -3287,7 +3287,7 @@ int zoo_async(zhandle_t *zh, const char *path,
         string_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_SYNC_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_SYNC_OP};
     struct SyncRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path);
     if (rc != ZOK) {
@@ -3317,7 +3317,7 @@ int zoo_aget_acl(zhandle_t *zh, const char *path, acl_completion_t completion,
         const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER(type ,ZOO_GETACL_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_GETACL_OP};
     struct GetACLRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path) ;
     if (rc != ZOK) {
@@ -3346,7 +3346,7 @@ int zoo_aset_acl(zhandle_t *zh, const char *path, int version,
         struct ACL_vector *acl, void_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid ,get_xid()), STRUCT_INITIALIZER (type , ZOO_SETACL_OP)};
+    struct RequestHeader h = {get_xid(), ZOO_SETACL_OP};
     struct SetACLRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path);
     if (rc != ZOK) {
@@ -3431,8 +3431,8 @@ static int CheckVersionRequest_init(zhandle_t *zh, struct CheckVersionRequest *r
 int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
         zoo_op_result_t *results, void_completion_t completion, const void *data)
 {
-    struct RequestHeader h = { STRUCT_INITIALIZER(xid, get_xid()), STRUCT_INITIALIZER(type, ZOO_MULTI_OP) };
-    struct MultiHeader mh = { STRUCT_INITIALIZER(type, -1), STRUCT_INITIALIZER(done, 1), STRUCT_INITIALIZER(err, -1) };
+    struct RequestHeader h = {get_xid(), ZOO_MULTI_OP};
+    struct MultiHeader mh = {-1, 1, -1};
     struct oarchive *oa = create_buffer_oarchive();
     completion_head_t clist = { 0 };
 
@@ -3444,7 +3444,7 @@ int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
         zoo_op_result_t *result = results+index;
         completion_list_t *entry = NULL;
 
-        struct MultiHeader mh = { STRUCT_INITIALIZER(type, op->type), STRUCT_INITIALIZER(done, 0), STRUCT_INITIALIZER(err, -1) };
+        struct MultiHeader mh = {op->type, 0, -1};
         rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh);
 
         switch(op->type) {