Fix alignment problem with zmq_msg_t.

Problem occurs on SPARC and ARM CPUs. This commit is a backport of
d9fb1d36ff (from
libzmq), first reported in https://github.com/zeromq/libzmq/issues/1325.
This commit is contained in:
Constantine Vetoshev 2016-08-16 13:31:46 -07:00
parent 4732951d05
commit 2b7b903a85

View File

@ -205,7 +205,10 @@ ZMQ_EXPORT int zmq_ctx_destroy (void *context);
/* 0MQ message definition. */
/******************************************************************************/
typedef struct zmq_msg_t {unsigned char _ [64];} zmq_msg_t;
/* union here ensures correct alignment on architectures that require it, e.g.
* SPARC and ARM
*/
typedef union zmq_msg_t { unsigned char _ [64]; void *p; } zmq_msg_t;
typedef void (zmq_free_fn) (void *data, void *hint);