本文整理汇总了C++中TAILQ_FOREACH函数的典型用法代码示例。如果您正苦于以下问题:C++ TAILQ_FOREACH函数的具体用法?C++ TAILQ_FOREACH怎么用?C++ TAILQ_FOREACH使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TAILQ_FOREACH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vdpau_codec_reinit
static void
vdpau_codec_reinit(media_codec_t *mc)
{
vdpau_codec_t *vc = mc->opaque;
vdpau_dev_t *vd = vc->vc_vd;
vdpau_video_surface_t *vvs;
VdpStatus r;
r = vd->vdp_decoder_create(vd->vd_dev, vc->vc_profile,
vc->vc_width, vc->vc_height,
vc->vc_refframes, &vc->vc_decoder);
if(r != VDP_STATUS_OK) {
TRACE(TRACE_INFO, "VDPAU", "Unable to reinit decoder: %s",
vdpau_errstr(vd, r));
return;
}
TAILQ_FOREACH(vvs, &vc->vc_vvs_free, vvs_link)
vd->vdp_video_surface_create(vd->vd_dev, VDP_CHROMA_TYPE_420,
vc->vc_width, vc->vc_height,
&vvs->vvs_surface);
TAILQ_FOREACH(vvs, &vc->vc_vvs_alloc, vvs_link)
vd->vdp_video_surface_create(vd->vd_dev, VDP_CHROMA_TYPE_420,
vc->vc_width, vc->vc_height,
&vvs->vvs_surface);
}
示例2: cmd_list_send
void
cmd_list_send(struct cmd_list *cmdlist, struct buffer *b)
{
struct cmd *cmd;
u_int n;
n = 0;
TAILQ_FOREACH(cmd, cmdlist, qentry)
n++;
buffer_write(b, &n, sizeof n);
TAILQ_FOREACH(cmd, cmdlist, qentry)
cmd_send(cmd, b);
}
示例3: control_callback
/* Control input callback. Read lines and fire commands. */
void
control_callback(struct client *c, int closed, __unused void *data)
{
char *line, *cause;
struct cmd_list *cmdlist;
struct cmd *cmd;
struct cmdq_item *item;
if (closed)
c->flags |= CLIENT_EXIT;
for (;;) {
line = evbuffer_readln(c->stdin_data, NULL, EVBUFFER_EOL_LF);
if (line == NULL)
break;
if (*line == '\0') { /* empty line exit */
c->flags |= CLIENT_EXIT;
break;
}
if (cmd_string_parse(line, &cmdlist, NULL, 0, &cause) != 0) {
item = cmdq_get_callback(control_error, cause);
cmdq_append(c, item);
} else {
TAILQ_FOREACH(cmd, &cmdlist->list, qentry)
cmd->flags |= CMD_CONTROL;
item = cmdq_get_command(cmdlist, NULL, NULL, 0);
cmdq_append(c, item);
cmd_list_free(cmdlist);
}
free(line);
}
}
示例4: usb_dump_entries
void
usb_dump_entries(void)
{
struct usb_blob *pub;
struct usb_device_id *id;
uint32_t x;
id = malloc(usb_blob_count * sizeof(*id));
if (id == NULL)
errx(EX_SOFTWARE, "Out of memory");
/* make linear array of all USB blobs */
x = 0;
TAILQ_FOREACH(pub, &usb_blob_head, entry)
id[x++] = pub->temp;
usb_sort_entries(id, usb_blob_count);
for (x = 0; x != usb_blob_count;)
x += usb_dump(id + x, usb_blob_count - x);
free(id);
printf("# %d USB entries processed\n\n", usb_blob_count);
}
示例5: cmd_unlink_window_exec
int
cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct winlink *wl;
struct window *w;
struct session *s, *s2;
struct session_group *sg;
u_int references;
if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
return (-1);
w = wl->window;
sg = session_group_find(s);
if (sg != NULL) {
references = 0;
TAILQ_FOREACH(s2, &sg->sessions, gentry)
references++;
} else
references = 1;
if (!args_has(self->args, 'k') && w->references == references) {
ctx->error(ctx, "window is only linked to one session");
return (-1);
}
server_unlink_window(s, wl);
recalculate_sizes();
return (0);
}
示例6: Request_parse_postvars
static void Request_parse_postvars(T R)
{
struct evkeyval *val;
char *post = NULL, *rawpost = NULL;
rawpost = g_strndup((char *)EVBUFFER_DATA(R->req->input_buffer), EVBUFFER_LENGTH(R->req->input_buffer));
if (rawpost) {
post = evhttp_decode_uri(rawpost);
g_free(rawpost);
}
R->POST = g_new0(struct evkeyvalq,1);
TAILQ_INIT(R->POST);
if (post) {
int i = 0;
char **p = g_strsplit(post,"&",0);
while (p[i]) {
struct evkeyval *header = g_new0(struct evkeyval,1);
char **kv = g_strsplit(p[i],"=",2);
if (! (kv[0] && kv[1])) break;
header->key = kv[0];
header->value = kv[1];
TAILQ_INSERT_TAIL(R->POST, header, next);
i++;
}
g_strfreev(p);
g_free(post);
}
TAILQ_FOREACH(val, R->POST, next)
TRACE(TRACE_DEBUG,"POST: [%s]->[%s]", val->key, val->value);
}
示例7: refresh_printer_tbl
/**
* Refresh the printer table if needed.
*/
void
refresh_printer_tbl(void)
{
struct printer_entry *entry;
struct printer_entry *entry_tmp;
if (this_tick <= printer_tick) {
HRDBG("no refresh needed");
return;
}
/* mark each entry as missing */
TAILQ_FOREACH(entry, &printer_tbl, link)
entry->flags &= ~HR_PRINTER_FOUND;
hrPrinter_get_OS_entries();
/*
* Purge items that disappeared
*/
entry = TAILQ_FIRST(&printer_tbl);
while (entry != NULL) {
entry_tmp = TAILQ_NEXT(entry, link);
if (!(entry->flags & HR_PRINTER_FOUND))
printer_entry_delete(entry);
entry = entry_tmp;
}
printer_tick = this_tick;
HRDBG("refresh DONE ");
}
示例8: levent_send_now
void
levent_send_now(struct lldpd *cfg)
{
struct lldpd_hardware *hardware;
TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries)
event_active(hardware->h_timer, EV_TIMEOUT, 1);
}
示例9: satip_device_block
static void
satip_device_block( const char *addr, int block )
{
extern const idclass_t satip_device_class;
tvh_hardware_t *th;
satip_device_t *sd;
satip_frontend_t *lfe;
int val = block < 0 ? 0 : block;
pthread_mutex_lock(&global_lock);
TVH_HARDWARE_FOREACH(th) {
if (!idnode_is_instance(&th->th_id, &satip_device_class))
continue;
sd = (satip_device_t *)th;
if (strcmp(sd->sd_info.addr, addr) == 0 && val != sd->sd_dbus_allow) {
sd->sd_dbus_allow = val;
if (block < 0) {
TAILQ_FOREACH(lfe, &sd->sd_frontends, sf_link)
mpegts_input_stop_all((mpegts_input_t *)lfe);
}
tvhinfo("satip", "address %s is %s", addr,
block < 0 ? "stopped" : (block > 0 ? "allowed" : "disabled"));
}
}
pthread_mutex_unlock(&global_lock);
}
示例10: reflow_rootward
static int
reflow_rootward(struct rtb_element *self,
struct rtb_element *instigator, rtb_ev_direction_t direction)
{
struct rtb_element *iter;
struct rtb_size inst_old_size = {
instigator->w,
instigator->h
};
self->layout_cb(self);
/* don't pass the reflow any further rootward if the element's
* size hasn't changed as a result of it. */
if ((instigator->w == inst_old_size.w &&
instigator->h == inst_old_size.h))
return 0;
TAILQ_FOREACH(iter, &self->children, child)
iter->reflow(iter, self, RTB_DIRECTION_LEAFWARD);
if (self->parent)
self->parent->reflow(self->parent, self, direction);
rtb_elem_mark_dirty(self);
return 1;
}
示例11: refresh_swrun_tbl
/**
* Refresh the hrSWRun and hrSWRunPert tables.
*/
static void
refresh_swrun_tbl(void)
{
struct swrun_entry *entry, *entry_tmp;
if (this_tick - swrun_tick < swrun_tbl_refresh) {
HRDBG("no refresh needed ");
return;
}
/* mark each entry as missing */
TAILQ_FOREACH(entry, &swrun_tbl, link)
entry->flags &= ~HR_SWRUN_FOUND;
swrun_OS_get_procs();
swrun_OS_get_kinfo();
/*
* Purge items that disappeared
*/
TAILQ_FOREACH_SAFE(entry, &swrun_tbl, link, entry_tmp)
if (!(entry->flags & HR_SWRUN_FOUND))
swrun_entry_delete(entry);
swrun_tick = this_tick;
HRDBG("refresh DONE");
}
示例12: FindWindows
static void
FindWindows(AG_Tlist *tl, AG_Window *win, int depth)
{
char text[AG_TLIST_LABEL_MAX];
AG_Window *wSub;
AG_Widget *wChild;
AG_TlistItem *it;
if (strncmp(OBJECT(win)->name, "_Popup-", sizeof("_Popup-")) == 0)
return;
Strlcpy(text, win->caption, sizeof(text));
if (strcmp(OBJECT(win)->name, "generic") == 0) {
it = AG_TlistAddS(tl, NULL,
win->caption[0] != '\0' ? win->caption : _("Untitled"));
} else {
it = AG_TlistAdd(tl, NULL, "%s (<%s>)",
win->caption[0] != '\0' ? win->caption : _("Untitled"),
OBJECT(win)->name);
}
it->p1 = win;
it->depth = depth;
it->cat = "window";
if (!TAILQ_EMPTY(&OBJECT(win)->children) ||
!TAILQ_EMPTY(&win->subwins)) {
it->flags |= AG_TLIST_HAS_CHILDREN;
}
if ((it->flags & AG_TLIST_HAS_CHILDREN) &&
AG_TlistVisibleChildren(tl, it)) {
TAILQ_FOREACH(wSub, &win->subwins, swins)
FindWindows(tl, wSub, depth+1);
OBJECT_FOREACH_CHILD(wChild, win, ag_widget)
FindWidgets(wChild, tl, depth+1);
}
}
示例13: Request_parse_getvars
static void Request_parse_getvars(T R)
{
struct evkeyval *val;
R->GET = g_new0(struct evkeyvalq,1);
evhttp_parse_query(R->uri, R->GET);
TAILQ_FOREACH(val, R->GET, next)
TRACE(TRACE_DEBUG,"GET: [%s]->[%s]", val->key, val->value);
}
示例14: status_timer_start_all
/* Start status timer for all clients. */
void
status_timer_start_all(void)
{
struct client *c;
TAILQ_FOREACH(c, &clients, entry)
status_timer_start(c);
}
示例15: rtb_elem_draw_children
void
rtb_elem_draw_children(struct rtb_element *self)
{
struct rtb_element *iter;
TAILQ_FOREACH(iter, &self->children, child)
rtb_elem_draw(iter, 0);
}