summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_socket.c
diff options
context:
space:
mode:
authorMichael Steinert <mike.steinert@gmail.com>2012-06-11 16:35:35 -0600
committerAlan Antonuk <alan.antonuk@gmail.com>2013-04-09 15:49:10 -0700
commit82cfd49e4dbb674669e8c91044ba317d1c075396 (patch)
treecacdb83d6b60d7b9cd12bfd628b700cb6b64632a /librabbitmq/amqp_socket.c
parent0f022fce389543404f86824ed6c5720d2502cd09 (diff)
downloadrabbitmq-c-82cfd49e4dbb674669e8c91044ba317d1c075396.tar.gz
Add checks for derived socket type
1. Use a single instance of the vtable for each object. This saves some memory at the expense of an extra pointer dereference per method invocation. 2. Compare the class vtable pointer in sub-class methods to determine if the object type is correct. Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
Diffstat (limited to 'librabbitmq/amqp_socket.c')
-rw-r--r--librabbitmq/amqp_socket.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index d7be798..4ce2093 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -52,32 +52,32 @@
ssize_t
amqp_socket_writev(amqp_socket_t *self, const struct iovec *iov, int iovcnt)
{
- return self->writev(self, iov, iovcnt);
+ return self->klass->writev(self, iov, iovcnt);
}
ssize_t
amqp_socket_send(amqp_socket_t *self, const void *buf, size_t len, int flags)
{
- return self->send(self, buf, len, flags);
+ return self->klass->send(self, buf, len, flags);
}
ssize_t
amqp_socket_recv(amqp_socket_t *self, void *buf, size_t len, int flags)
{
- return self->recv(self, buf, len, flags);
+ return self->klass->recv(self, buf, len, flags);
}
int
amqp_socket_open(amqp_socket_t *self, const char *host, int port)
{
- return self->open(self, host, port);
+ return self->klass->open(self, host, port);
}
int
amqp_socket_close(amqp_socket_t *self)
{
if (self) {
- return self->close(self);
+ return self->klass->close(self);
}
return 0;
}
@@ -85,13 +85,13 @@ amqp_socket_close(amqp_socket_t *self)
int
amqp_socket_error(amqp_socket_t *self)
{
- return self->error(self);
+ return self->klass->error(self);
}
int
amqp_socket_get_sockfd(amqp_socket_t *self)
{
- return self->get_sockfd(self);
+ return self->klass->get_sockfd(self);
}
int amqp_open_socket(char const *hostname,