12 #define DISPATCH_NEW_PRIVATE
13 #define DISPATCH_PRIVATE
33 uint16_t *maxptr = NULL;
37 else if (u && *u > *maxptr)
39 } SMARTLIST_FOREACH_END(u);
41 return maxptr ? *maxptr : dflt;
49 CTASSERT(
sizeof(uint16_t) ==
sizeof(channel_id_t));
57 return tor_strdup(
"<>");
94 size_t n_recv = smartlist_len(receivers);
96 ent = tor_malloc_zero(offsetof(dtbl_entry_t, rcv) +
97 sizeof(dispatch_rcv_t) * n_recv);
102 memcpy(&ent->rcv[rcv_sl_idx], rcv,
sizeof(*rcv));
106 } SMARTLIST_FOREACH_END(rcv);
122 const size_t n_chans = (size_t)
131 d->n_queues = n_chans;
132 d->n_types = n_types;
136 for (
size_t i = 0; i < n_types; ++i) {
144 d->typefns[fns_sl_idx].free_fn = fns->free_fn;
146 d->typefns[fns_sl_idx].fmt_fn = fns->fmt_fn;
148 } SMARTLIST_FOREACH_END(fns);
151 d->queues = tor_calloc(d->n_queues,
sizeof(dqueue_t));
152 for (
size_t i = 0; i < d->n_queues; ++i) {
153 TOR_SIMPLEQ_INIT(&d->queues[i].queue);
158 d->table = tor_calloc(d->n_msgs,
sizeof(dtbl_entry_t *));
161 } SMARTLIST_FOREACH_END(rcv);
166 if (d->table[type_sl_idx])
167 d->table[type_sl_idx]->type = *type;
168 } SMARTLIST_FOREACH_END(type);
171 if (d->table[chan_sl_idx])
172 d->table[chan_sl_idx]->channel = *chan;
173 } SMARTLIST_FOREACH_END(chan);