本文整理汇总了C++中zlist_first函数的典型用法代码示例。如果您正苦于以下问题:C++ zlist_first函数的具体用法?C++ zlist_first怎么用?C++ zlist_first使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zlist_first函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zmsg_last
zframe_t *
zmsg_last (zmsg_t *self)
{
assert (self);
zframe_t *frame = (zframe_t *) zlist_first (self->frames);
while (frame) {
zframe_t *next = (zframe_t *) zlist_next (self->frames);
if (!next)
break;
frame = next;
}
return frame;
}
示例2: s_timer_remove
static void
s_timer_remove (zloop_t *self, int timer_id)
{
s_timer_t *timer = (s_timer_t *) zlist_first (self->timers);
while (timer) {
if (timer->timer_id == timer_id) {
zlist_remove (self->timers, timer);
free (timer);
break;
}
timer = (s_timer_t *) zlist_next (self->timers);
}
}
示例3: zsync_node_peers_lookup
static zsync_peer_t *
zsync_node_peers_lookup (zsync_node_t *self, char *uuid)
{
assert (self);
zsync_peer_t *peer = zlist_first (self->peers);
while (peer) {
if (streq (zsync_peer_uuid (peer), uuid)) {
return peer;
}
peer = zlist_next (self->peers);
}
return NULL;
}
示例4: invoke_cbs
static int invoke_cbs (flux_t *h, int64_t j, json_object *jcb, int errnum)
{
int rc = 0;
cb_pair_t *c = NULL;
jscctx_t *ctx = getctx (h);
for (c = zlist_first (ctx->callbacks); c; c = zlist_next (ctx->callbacks)) {
if (c->cb (jcb, c->arg, errnum) < 0) {
flux_log (h, LOG_ERR, "callback returns an error");
rc = -1;
}
}
return rc;
}
示例5: START_TEST
END_TEST
// --------------------------------------------------------------------------
/// Try to _pop () two succeesding lists
START_TEST(test_msg_pop_l_double)
{
sam_selftest_introduce ("test_msg_pop_l_double");
sam_selftest_introduce ("test_msg_get_l_double");
zmsg_t *zmsg = zmsg_new ();
if (zmsg_pushstr (zmsg, "two") ||
zmsg_pushstr (zmsg, "1") ||
zmsg_pushstr (zmsg, "one") ||
zmsg_pushstr (zmsg, "1")) {
ck_abort_msg ("could not build zmsg");
}
sam_msg_t *msg = sam_msg_new (&zmsg);
ck_assert_int_eq (sam_msg_size (msg), 4);
zlist_t *list1, *list2;
int rc = sam_msg_pop (msg, "ll", &list1, &list2);
ck_assert_int_eq (rc, 0);
ck_assert_int_eq (sam_msg_size (msg), 0);
ck_assert_int_eq (zlist_size (list1), 1);
ck_assert_int_eq (zlist_size (list2), 1);
ck_assert_str_eq (zlist_first (list1), "one");
ck_assert_str_eq (zlist_first (list2), "two");
zlist_destroy (&list1);
zlist_destroy (&list2);
sam_msg_destroy (&msg);
}
示例6: s_worker_ready
static void
s_worker_ready (worker_t *self, zlist_t *workers)
{
worker_t *worker = (worker_t *) zlist_first (workers);
while (worker) {
if (streq (self->identity, worker->identity)) {
zlist_remove (workers, worker);
s_worker_destroy (&worker);
break;
}
worker = (worker_t *) zlist_next (workers);
}
zlist_append (workers, self);
}
示例7: s_was_pending
// If message was already on pending list, remove it and return true,
// else return false.
static int
s_was_pending (clonesrv_t *self, kvmsg_t *kvmsg)
{
kvmsg_t *held = (kvmsg_t *) zlist_first (self->pending);
while (held) {
if (memcmp (kvmsg_uuid (kvmsg),
kvmsg_uuid (held), sizeof (uuid_t)) == 0) {
zlist_remove (self->pending, held);
return true;
}
held = (kvmsg_t *) zlist_next (self->pending);
}
return false;
}
示例8: pass_update
void
pass_update (char *sender, zlist_t *fmetadata)
{
printf ("[ST] PASS_UPDATE from %s: %"PRId64"\n", sender, zlist_size (fmetadata));
uint64_t size = 0;
zlist_t *paths = zlist_new ();
zs_fmetadata_t *meta = zlist_first (fmetadata);
while (meta) {
zlist_append (paths, zs_fmetadata_path (meta));
size += zs_fmetadata_size (meta);
meta = zlist_next (fmetadata);
}
zsync_agent_send_request_files (agent, sender, paths, size);
}
示例9: disp_table_remove_all
halutils_err_e disp_table_remove_all (disp_table_t *self)
{
assert (self);
zlist_t *hash_keys = zhash_keys (self->table_h);
void * table_item = zlist_first (hash_keys);
for (; table_item; table_item = zlist_next (hash_keys)) {
zhash_delete (self->table_h, (char *) table_item);
}
zlist_destroy (&hash_keys);
return HALUTILS_SUCCESS;
}
示例10: zlist_first
const char *flux_kvsitr_next (flux_kvsitr_t *itr)
{
const char *name = NULL;
if (itr) {
if (itr->reset)
name = zlist_first (itr->keys);
else
name = zlist_next (itr->keys);
if (name)
itr->reset = false;
}
return name;
}
示例11: subprocess_run_hooks
static int subprocess_run_hooks (struct subprocess *p, zlist_t *hooks)
{
subprocess_cb_f fn = zlist_first (hooks);
int rc = 0;
subprocess_ref (p);
while (fn) {
if ((rc = fn (p)) < 0)
goto done;
fn = zlist_next (hooks);
}
done:
subprocess_unref (p);
return (rc);
}
示例12: zcertstore_fprint
void
zcertstore_fprint (zcertstore_t *self, FILE *file)
{
if (self->location)
fprintf (file, "Certificate store at %s:\n", self->location);
else
fprintf (file, "Certificate store\n");
zcert_t *cert = (zcert_t *) zlist_first (self->cert_list);
while (cert) {
zcert_fprint (cert, file);
cert = (zcert_t *) (zcert_t *) zlist_next (self->cert_list);
}
}
示例13: zctx_destroy
void
zctx_destroy (zctx_t **self_p)
{
assert (self_p);
if (*self_p) {
zctx_t *self = *self_p;
while (zlist_size (self->sockets))
zctx__socket_destroy (self, zlist_first (self->sockets));
zlist_destroy (&self->sockets);
if (self->main && self->context)
zmq_term (self->context);
free (self);
*self_p = NULL;
}
}
示例14: mount_sub_purge
static void
mount_sub_purge (mount_t *self, client_t *client)
{
sub_t *sub = (sub_t *) zlist_first (self->subs);
while (sub) {
if (sub->client == client) {
sub_t *next = (sub_t *) zlist_next (self->subs);
zlist_remove (self->subs, sub);
sub_destroy (&sub);
sub = next;
}
else
sub = (sub_t *) zlist_next (self->subs);
}
}
示例15: subscription_match
static bool subscription_match (client_t *c, const flux_msg_t *msg)
{
subscription_t *sub;
const char *topic;
if (flux_msg_get_topic (msg, &topic) < 0)
return false;
sub = zlist_first (c->subscriptions);
while (sub) {
if (!strncmp (topic, sub->topic, strlen (sub->topic)))
return true;
sub = zlist_next (c->subscriptions);
}
return false;
}