Michael Granger avatar Michael Granger committed e6fb1af

Fix a few things in the extension.

* Correct argument ordering for zmq_msg_{recv,send}.
* Rename ZMQ.version to ZMQ.zeromq_version to disambiguate
it from the gem version.

Comments (0)

Files changed (1)

 
 /*
  * call-seq:
- *   ZMQ.version() -> [major, minor, patch]
+ *   ZMQ.zeromq_version() -> [major, minor, patch]
  *
  * Returns the version of the zeromq library.
  */
-static VALUE module_version (VALUE self_)
+static VALUE module_zeromq_version (VALUE self_)
 {
     int major, minor, patch;
     
 {
     struct zmq_send_recv_args *send_args = (struct zmq_send_recv_args *)args_;
 
-    send_args->rc = zmq_msg_send(send_args->socket, send_args->msg, send_args->flags);
+    send_args->rc = zmq_msg_send(send_args->msg, send_args->socket, send_args->flags);
     
     return Qnil;
 }
     }
     else
 #endif
-        rc = zmq_msg_send (s->socket, &msg, flags);
+        rc = zmq_msg_send (&msg, s->socket, flags);
     if (rc != 0 && zmq_errno () == EAGAIN) {
         rc = zmq_msg_close (&msg);
         assert (rc == 0);
 {
     struct zmq_send_recv_args *recv_args = (struct zmq_send_recv_args *)args_;
 
-    recv_args->rc = zmq_msg_recv(recv_args->socket, recv_args->msg, recv_args->flags);
+    recv_args->rc = zmq_msg_recv(recv_args->msg, recv_args->socket, recv_args->flags);
     
     return Qnil;
 }
     }
     else
 #endif
-        rc = zmq_msg_recv (s->socket, &msg, flags);
+        rc = zmq_msg_recv (&msg, s->socket, flags);
     if (rc != 0 && zmq_errno () == EAGAIN) {
         rc = zmq_msg_close (&msg);
         assert (rc == 0);
     return Qnil;
 }
 
-void Init_zmq ()
+void Init_zmq_ext ()
 {
     VALUE zmq_module = rb_define_module ("ZMQ");
-    rb_define_singleton_method (zmq_module, "version", module_version, 0);
+    rb_define_singleton_method (zmq_module, "zeromq_version", module_zeromq_version, 0);
     rb_define_singleton_method (zmq_module, "select", module_select, -1);
 
     exception_type = rb_define_class_under (zmq_module, "Error", rb_eRuntimeError );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.