Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cosmetic cleanups

  • Loading branch information...
commit f1b7873733b563f767cd99c8455c99233f2c9786 1 parent ca14de6
@hintjens hintjens authored
View
2  AUTHORS
@@ -9,3 +9,5 @@ Contributors
Steven McCoy <steven.mccoy@miru.hk>
Luc Heinrich <luc@honk-honk.com>
William Roberts <bill.c.roberts@gmail.com>
+AJ Lewis <aj.lewis@quantum.com>
+
View
2  sockopts.gsl
@@ -201,11 +201,13 @@ zsockopt_test (Bool verbose)
// @selftest
zctx_t *ctx = zctx_new ();
+ assert (ctx);
void *socket;
.for version
#if (ZMQ_VERSION_MAJOR == $(major))
. for option
socket = zsocket_new (ctx, ZMQ_$(TEST));
+ assert (socket);
. if mode = "rw" | mode = "w"
. if ctype = "int"
zsockopt_set_$(name) (socket, 1);
View
1  src/zctx.c
@@ -119,7 +119,6 @@ zctx_new (void)
#endif
end:
-
return self;
}
View
1  src/zframe.c
@@ -187,7 +187,6 @@ zframe_send (zframe_t **self_p, void *socket, int flags)
error = EINVAL;
end:
-
return error;
}
View
1  src/zhash.c
@@ -288,7 +288,6 @@ zhash_insert (zhash_t *self, char *key, void *value)
if ((!error) && (!item))
error = -1;
}
-
return error;
}
View
4 src/zlist.c
@@ -243,12 +243,12 @@ zlist_copy (zlist_t *self)
goto end;
struct node_t *node;
- for (node = self->head; node; node = node->next)
+ for (node = self->head; node; node = node->next) {
if (!zlist_append (copy, node->item)) {
zlist_destroy(&copy);
break;
}
-
+ }
end:
return copy;
}
View
10 src/zloop.c
@@ -123,14 +123,14 @@ s_rebuild_pollset (zloop_t *self)
self->poll_size = zlist_size (self->pollers);
self->pollset = (zmq_pollitem_t *) zmalloc (
self->poll_size * sizeof (zmq_pollitem_t));
- if (!(self->pollset)) {
+ if (!self->pollset) {
error = ENOMEM;
goto end;
}
self->pollact = (s_poller_t *) zmalloc (
self->poll_size * sizeof (s_poller_t));
- if (!(self->pollact)) {
+ if (!self->pollact) {
error = ENOMEM;
goto end;
}
@@ -194,17 +194,17 @@ zloop_new (void)
goto end;
self->pollers = zlist_new ();
- if (!(self->pollers)) {
+ if (!self->pollers) {
error = ENOMEM;
goto end;
}
self->timers = zlist_new ();
- if (!(self->timers)) {
+ if (!self->timers) {
error = ENOMEM;
goto end;
}
self->zombies = zlist_new ();
- if (!(self->zombies)) {
+ if (!self->zombies) {
error = ENOMEM;
goto end;
}
View
51 src/zmsg.c
@@ -60,15 +60,14 @@ zmsg_new (void)
self = (zmsg_t *) zmalloc (sizeof (zmsg_t));
if (!self)
- goto end;
+ goto end;
self->frames = zlist_new ();
if (!(self->frames)) {
- free (self);
- self = NULL;
- goto end;
+ free (self);
+ self = NULL;
+ goto end;
}
-
end:
return self;
}
@@ -113,13 +112,12 @@ zmsg_recv (void *socket)
break; // Interrupted or terminated
}
if (zmsg_add (self, frame)) {
- zmsg_destroy (&self);
- break;
- }
+ zmsg_destroy (&self);
+ break;
+ }
if (!zframe_more (frame))
break; // Last message frame
}
-
end:
return self;
}
@@ -279,7 +277,6 @@ int zmsg_add_str_to_framelist (int (*list_fxn)(zlist_t *, void *),
error = ENOMEM;
goto end;
}
-
int required = vsnprintf (string, size, format, argptr);
if (required >= size) {
char *tmpstring;
@@ -292,14 +289,12 @@ int zmsg_add_str_to_framelist (int (*list_fxn)(zlist_t *, void *),
string = tmpstring;
vsnprintf (string, size, format, argptr);
}
-
self->content_size += strlen (string);
zframe_t *frame = zframe_new (string, strlen (string));
if (!frame) {
error = ENOMEM;
goto end;
}
-
error = list_fxn (self->frames, frame);
end:
@@ -373,15 +368,14 @@ zmsg_wrap (zmsg_t *self, zframe_t *frame)
int error = 0;
error = zmsg_pushmem (self, "", 0);
if (error)
- goto end;
+ goto end;
error = zmsg_push (self, frame);
if (error) {
- // Rewind the empty frame
- zmsg_pop (self);
- goto end;
+ // Rewind the empty frame
+ zmsg_pop (self);
+ goto end;
}
-
end:
return error;
}
@@ -481,10 +475,10 @@ zmsg_save (zmsg_t *self, FILE *file)
// --------------------------------------------------------------------------
// Load/append an open file into message, create new message if
-// null message provided. Return 0 if OK, non-zero otherwise. The
+// null message provided. Return 0 if OK, non-zero otherwise. The
// returned message should be identical to the passed in message on
// error.
-//
+//
int
zmsg_load (zmsg_t *self, FILE *file, zmsg_t **return_self)
@@ -526,11 +520,9 @@ zmsg_load (zmsg_t *self, FILE *file, zmsg_t **return_self)
goto end;
}
}
-
error = zmsg_add (tmp_msg, frame);
- if (error)
- goto end;
-
+ if (error)
+ goto end;
frame_count++;
}
else {
@@ -541,9 +533,8 @@ zmsg_load (zmsg_t *self, FILE *file, zmsg_t **return_self)
else {
if (feof (file))
goto end;
-
error = ferror (file);
- if (!error)
+ if (!error)
error = 1;
goto end; // Unable to read properly, quit
}
@@ -566,9 +557,7 @@ zmsg_load (zmsg_t *self, FILE *file, zmsg_t **return_self)
zmsg_destroy (&tmp_msg);
}
}
-
*return_self = tmp_msg;
-
return error;
}
@@ -681,10 +670,9 @@ zmsg_decode (byte *buffer, size_t buffer_size)
zframe_t *frame = zframe_new (source, frame_size);
if (frame) {
if (zmsg_add (self, frame)) {
- zmsg_destroy (&self);
- break;
- }
-
+ zmsg_destroy (&self);
+ break;
+ }
source += frame_size;
}
else {
@@ -727,7 +715,6 @@ zmsg_dup (zmsg_t *self)
}
end:
-
return copy;
}
View
1  src/zsockopt.c
@@ -1226,7 +1226,6 @@ zsockopt_test (Bool verbose)
// @selftest
zctx_t *ctx = zctx_new ();
assert (ctx);
-
void *socket;
#if (ZMQ_VERSION_MAJOR == 2)
socket = zsocket_new (ctx, ZMQ_SUB);
View
5 src/zthread.c
@@ -94,6 +94,7 @@ s_thread_shim (void *args)
shim->attached (shim->args, shim->ctx, shim->pipe);
else
shim->detached (shim->args);
+
zctx_destroy (&shim->ctx);
free (shim);
return NULL;
@@ -187,7 +188,6 @@ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args)
error = ENOMEM;
goto end;
}
-
zsockopt_set_hwm (pipe, 1);
zsocket_bind (pipe, "inproc://zctx-pipe-%p", pipe);
@@ -197,7 +197,6 @@ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args)
error = ENOMEM;
goto end;
}
-
shim->attached = thread_fn;
shim->args = args;
shim->ctx = zctx_shadow (ctx);
@@ -205,7 +204,6 @@ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args)
error = ENOMEM;
goto end;
}
-
// Connect child pipe to our pipe
shim->pipe = zsocket_new (shim->ctx, ZMQ_PAIR);
if (!shim->pipe) {
@@ -226,7 +224,6 @@ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args)
}
zsocket_destroy (ctx, pipe);
}
-
return pipe;
}
Please sign in to comment.
Something went wrong with that request. Please try again.