您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ utarray_next函数代码示例

51自学网 2021-06-03 09:23:55
  C++
这篇教程C++ utarray_next函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中utarray_next函数的典型用法代码示例。如果您正苦于以下问题:C++ utarray_next函数的具体用法?C++ utarray_next怎么用?C++ utarray_next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了utarray_next函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: report_status

/* report to all configured destinations */void report_status(pmtr_t *cfg) {  int rc;  time_t now = time(NULL);  /* construct msg */  utstring_clear(cfg->s);  utstring_printf(cfg->s, "report %s/n", cfg->report_id);  job_t *j = NULL;  while ( (j=(job_t*)utarray_next(cfg->jobs,j))) {    if (j->respawn == 0) continue; /* don't advertise one-time jobs */    utstring_printf(cfg->s, "%s %c %u %d %s/n", j->name, j->disabled?'d':'e',                    (unsigned)(now - j->start_ts), (int)j->pid,                    *((char**)utarray_front(&j->cmdv)));  }  /* send to all dests */  int *fd=NULL;  while ( (fd=(int*)utarray_next(cfg->report,fd))) {    rc = write(*fd,utstring_body(cfg->s),utstring_len(cfg->s));    if (rc < 0 && errno != ECONNREFUSED)       syslog(LOG_INFO,"write error: %s", strerror(errno));    if (rc >= 0 && rc < utstring_len(cfg->s)) {      syslog(LOG_INFO,"incomplete write %d/%d", rc, utstring_len(cfg->s));    }  }}
开发者ID:bauman,项目名称:pmtr,代码行数:27,


示例2: do_attrition

int do_attrition(void) {  int rc = -1, nfiles=0;  UT_array *files;  UT_array *stats;   utarray_new(files,&ut_str_icd);  utarray_new(stats,&stats_icd);  if (get_files(files,stats) == -1) goto done;  /* tally up their sizes */  int64_t total_sz=0;  file_stat_t *fs=NULL;  while ( (fs=(file_stat_t*)utarray_next(stats,fs))) total_sz += fs->sb.st_size;  if (total_sz < cf.sz_bytes) { rc = 0; goto done; }  /* we're oversize. sort the files oldest first and delete til under max size*/  utarray_sort(stats,attrition_sort);  fs=NULL;  while ( (fs=(file_stat_t*)utarray_next(stats,fs))) {    char *file = *(char**)utarray_eltptr(files, fs->file_idx);    if (cf.verbose) syslog(LOG_INFO,"removing %s (size %ld)", file, (long)fs->sb.st_size);    if (cf.dry_run || (unlink(file) == 0)) {      total_sz -= fs->sb.st_size;      nfiles++;      if (total_sz < cf.sz_bytes) { rc = 0; goto done; }    } else {      syslog(LOG_ERR,"can't unlink %s: %s", file, strerror(errno));    }  } done:  if (cf.verbose) syslog(LOG_INFO,"%d files removed", nfiles);  utarray_free(files);  utarray_free(stats);  return rc;}
开发者ID:Tolchi,项目名称:misc,代码行数:35,


示例3: append_to_client_buf

void append_to_client_buf(UT_string *f) {  assert(utarray_len(cfg.outbufs) > 0);  UT_string **s=NULL;  size_t l,least,c;  char *b;  int i=0,lx;  b = utstring_body(f);  l = utstring_len(f);  switch(cfg.mode) {    case fan:          // send to ALL clients      while ( (s=(UT_string**)utarray_next(cfg.outbufs,s))) {        utstring_bincpy(*s,b,l);      }      break;    case round_robin:  // send to ONE client       while ( (s=(UT_string**)utarray_next(cfg.outbufs,s))) {        c = utstring_len(*s);        if ((i==0) || (c < least)) {least=c; lx=i;}        i++;      }      s = (UT_string**)utarray_eltptr(cfg.outbufs,lx);      utstring_bincpy(*s,b,l);      break;  }}
开发者ID:JHUAPL,项目名称:kvspool,代码行数:27,


示例4: close_sockets

void close_sockets(pmtr_t *cfg) {  int *fd;  fd=NULL; while( (fd=(int*)utarray_next(cfg->listen,fd))) close(*fd);  fd=NULL; while( (fd=(int*)utarray_next(cfg->report,fd))) close(*fd);  utarray_clear(cfg->listen);  utarray_clear(cfg->report);}
开发者ID:bauman,项目名称:pmtr,代码行数:7,


示例5: fcitx_utils_join_string_list

FCITX_EXPORT_APIchar* fcitx_utils_join_string_list(UT_array* list, char delm){    if (!list)        return NULL;    if (utarray_len(list) == 0)        return strdup("");    size_t len = 0;    char** str;    for (str = (char**) utarray_front(list);         str != NULL;         str = (char**) utarray_next(list, str))    {        len += strlen(*str) + 1;    }    char* result = (char*)malloc(sizeof(char) * len);    char* p = result;    for (str = (char**) utarray_front(list);         str != NULL;         str = (char**) utarray_next(list, str))    {        size_t strl = strlen(*str);        memcpy(p, *str, strl);        p += strl;        *p = delm;        p++;    }    result[len - 1] = '/0';    return result;}
开发者ID:13572293130,项目名称:fcitx,代码行数:34,


示例6: FcitxXkbDBusGetLayouts

void FcitxXkbDBusGetLayouts(FcitxXkbDBus* xkbdbus, DBusMessage* message){    DBusMessageIter iter, sub;    dbus_message_iter_init_append(message, &iter);    dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(ssss)", &sub);    FcitxXkbRules* rules = xkbdbus->rules;    FcitxIsoCodes* isocodes = xkbdbus->isocodes;    char* lang = NULL;#define GET_LANG /    do { /        char** plang = NULL; /        plang = (char**) utarray_front(layoutInfo->languages); /        lang = NULL; /        if (plang) { /            FcitxIsoCodes639Entry* entry = FcitxIsoCodesGetEntry(isocodes, *plang); /            if (entry) { /                lang = entry->iso_639_1_code; /            } /        } /    } while (0)    if (rules) {        FcitxXkbLayoutInfo* layoutInfo;        for (layoutInfo = (FcitxXkbLayoutInfo*) utarray_front(rules->layoutInfos);            layoutInfo != NULL;            layoutInfo = (FcitxXkbLayoutInfo*) utarray_next(rules->layoutInfos, layoutInfo))        {            char* description = dgettext("xkeyboard-config",                                         layoutInfo->description);            GET_LANG;            FcitxXkbDBusAppendLayout(&sub, layoutInfo->name, "",                                     description, lang);            FcitxXkbVariantInfo* variantInfo;            for (variantInfo = (FcitxXkbVariantInfo*) utarray_front(layoutInfo->variantInfos);                variantInfo != NULL;                variantInfo = (FcitxXkbVariantInfo*) utarray_next(layoutInfo->variantInfos, variantInfo))            {                char *description;                fcitx_utils_alloc_cat_str(                    description,                    dgettext("xkeyboard-config", layoutInfo->description),                    " - ",                    dgettext("xkeyboard-config", variantInfo->description));                GET_LANG;                FcitxXkbDBusAppendLayout(&sub, layoutInfo->name,                                         variantInfo->name, description, lang);                free(description);            }        }    }    else {        char *description = dgettext("xkeyboard-config", "English (US)");        FcitxXkbDBusAppendLayout(&sub, "us", "", description, "en");    }    dbus_message_iter_close_container(&iter, &sub);}
开发者ID:HenryHu,项目名称:fcitx,代码行数:58,


示例7: mark_writable

void mark_writable() {  /* mark writability-interest for any clients with pending output */  int *fd=NULL, *i=NULL;  UT_string **s=NULL;  while ( (fd=(int*)utarray_next(cfg.clients,fd))) {    s=(UT_string**)utarray_next(cfg.outbufs,s); assert(s);    i=(int*)utarray_next(cfg.outidxs,i);        assert(i);    if (utstring_len(*s) > *i) mod_epoll(EPOLLIN|EPOLLOUT, *fd);  }}
开发者ID:JHUAPL,项目名称:kvspool,代码行数:10,


示例8: main

int main() {  UT_array *a;  int i, *p;  utarray_new(a, &ut_int_icd);  for(i=0;i<10;i++) utarray_push_back(a,&i);  for(p=(int*)utarray_front(a); p; p=(int*)utarray_next(a,p)) printf("%d ",*p);  printf("/n");  utarray_sort(a,reverse);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_erase(a,3,3);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_erase(a,1,2);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_erase(a,0,1);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_erase(a,3,1);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_resize(a,5);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_resize(a,3);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_erase(a,0,3);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p);  printf("/n");  utarray_free(a);  return 0;}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:34,


示例9: FcitxInstanceEnd

FCITX_EXPORT_APIvoid FcitxInstanceEnd(FcitxInstance* instance){    FcitxInstanceSaveAllIM(instance);        if (instance->uinormal && instance->uinormal->ui->Destroy)        instance->uinormal->ui->Destroy(instance->uinormal->addonInstance);        if (instance->uifallback && instance->uifallback->ui->Destroy)        instance->uifallback->ui->Destroy(instance->uifallback->addonInstance);        instance->uifallback = NULL;    instance->ui = NULL;    instance->uinormal = NULL;    /* handle exit */    FcitxAddon** pimclass;    FcitxAddon** pfrontend;    FcitxFrontend* frontend;    FcitxInputContext* rec = NULL;    for (pimclass = (FcitxAddon**) utarray_front(&instance->imeclasses);            pimclass != NULL;            pimclass = (FcitxAddon**) utarray_next(&instance->imeclasses, pimclass)        ) {        if ((*pimclass)->imclass->Destroy)            (*pimclass)->imclass->Destroy((*pimclass)->addonInstance);    }    for (rec = instance->ic_list; rec != NULL; rec = rec->next) {        pfrontend = (FcitxAddon**) utarray_eltptr(&instance->frontends, rec->frontendid);        frontend = (*pfrontend)->frontend;        frontend->CloseIM((*pfrontend)->addonInstance, rec);    }    for (rec = instance->ic_list; rec != NULL; rec = rec->next) {        pfrontend = (FcitxAddon**) utarray_eltptr(&instance->frontends, rec->frontendid);        frontend = (*pfrontend)->frontend;        frontend->DestroyIC((*pfrontend)->addonInstance, rec);    }    int frontendid = 0;    for (pfrontend = (FcitxAddon**) utarray_front(&instance->frontends);            pfrontend != NULL;            pfrontend = (FcitxAddon**) utarray_next(&instance->frontends, pfrontend)        ) {        if (pfrontend == NULL)            return;        FcitxFrontend* frontend = (*pfrontend)->frontend;        frontend->Destroy((*pfrontend)->addonInstance);        frontendid++;    }    sem_post(instance->sem);}
开发者ID:pkg-ime,项目名称:fcitx,代码行数:55,


示例10: euclidean_distance_custom

const float euclidean_distance_custom(const char *str1, const char *str2, std_tokenizer_t *tokenizer) {	UT_array *t1 = tokenizer->tok_utarr_func(str1, tokenizer->delimiters);	UT_array *t2 = tokenizer->tok_utarr_func(str2, tokenizer->delimiters);	hash_token_t *h1 = tokenizer->tok_uq_hash_func(str1, tokenizer->delimiters);	hash_token_t *h2 = tokenizer->tok_uq_hash_func(str2, tokenizer->delimiters);	hash_token_t *all = merge_tokens(h1, h2);	hash_token_t *s;	int cs1, cs2;	float td = 0;	char **tmp;	for(s = all; s != NULL; s = s->hh.next) {		cs1 = 0;		cs2 = 0;		while((tmp = (char **) utarray_next(t1, tmp))) {			if(strcmp(*tmp, s->value) == 0)				cs1++;		}		while((tmp = (char **) utarray_next(t2, tmp))) {			if(strcmp(*tmp, s->value) == 0)				cs2++;		}		td += (float)(((float)cs1 - (float)cs2) * ((float)cs1 - (float)cs2));	}	utarray_free(t1);	utarray_free(t2);	hash_token_free(h1);	hash_token_free(h2);	hash_token_free(all);	return sqrtf(td);}
开发者ID:Simmetrics,项目名称:libsimmetrics,代码行数:49,


示例11: set_sample_tainted

int set_sample_tainted( dba_context* ctx ) {        const char* img;    UT_array* fblocks;    TSK_DADDR_T  st_haddr,                  ed_haddr;    TSK_DADDR_T* haddr_tuple;     UT_array* fnames;     char**    fname;    img     = get_device_image( "ide0-hd0" );    fblocks = tsk_find_haddr_by_filename( img, ctx->sample_gpath );    qemu_mutex_lock( &qemu_global_mutex );    for( haddr_tuple  = (TSK_DADDR_T*)utarray_front(fblocks);         haddr_tuple != NULL;         haddr_tuple  = (TSK_DADDR_T*)utarray_next(fblocks, haddr_tuple) ) {        st_haddr = haddr_tuple[0];        ed_haddr = haddr_tuple[1];        fnames = tsk_get_filename_by_haddr( img, st_haddr );        if( fnames == NULL )            continue;        for( fname  = (char**)utarray_front(fnames);             fname != NULL;             fname  = (char**)utarray_next(fnames, fname) ) {            if( strcasecmp(*fname, ctx->sample_gpath) != 0 )                 continue;            dift_contaminate_disk_or( st_haddr, ed_haddr - st_haddr + 1, ctx->taint.tag );            break;        }        utarray_free( fnames );    }    utarray_free( fblocks );    qemu_mutex_unlock( &qemu_global_mutex );    return 0;}
开发者ID:misterlihao,项目名称:MBA,代码行数:48,


示例12: cmdline_req_run

void cmdline_req_run(Cmdstr *caller, Cmdline *cmdline){  if (!cmdline->cmds || cmdline->err)    return;  if (utarray_len(cmdline->cmds) == 1) {    Cmdstr *single = cmdline_getcmd(cmdline);    single->caller = caller;    return cmd_run(single, cmdline);  }  char *full_line = cmdline->line;  int len = strlen(full_line);  char *last = &full_line[len+1];  bool waspipe = false;  Cmdstr *cmd = NULL;  while ((cmd = (Cmdstr*)utarray_next(cmdline->cmds, cmd))) {    char *line = &full_line[cmd->st];    if (line < last && waspipe)      line++;    if (cmd->bar)      full_line[cmd->ed] = '/0';    cmd_eval(NULL, line);    waspipe = cmd->bar;  }}
开发者ID:jollywho,项目名称:nav,代码行数:29,


示例13: MergeRules

void MergeRules(FcitxXkbRules* rules, FcitxXkbRules* rulesextra){    utarray_concat(rules->modelInfos, rulesextra->modelInfos);    utarray_concat(rules->optionGroupInfos, rulesextra->optionGroupInfos);    FcitxXkbLayoutInfo* layoutInfo;    UT_array toAdd;    utarray_init(&toAdd, fcitx_ptr_icd);    for (layoutInfo = (FcitxXkbLayoutInfo*) utarray_front(rulesextra->layoutInfos);         layoutInfo != NULL;         layoutInfo = (FcitxXkbLayoutInfo*) utarray_next(rulesextra->layoutInfos, layoutInfo))    {        FcitxXkbLayoutInfo* l = FindByName(rules, layoutInfo->name);        if (l) {            utarray_concat(l->languages, layoutInfo->languages);            utarray_concat(l->variantInfos, layoutInfo->variantInfos);        }        else            utarray_push_back(&toAdd, &layoutInfo);    }    unsigned int i;    for(i = 0;i < utarray_len(&toAdd);i++) {        FcitxXkbLayoutInfo* p = *(FcitxXkbLayoutInfo**)utarray_eltptr(&toAdd, i);        utarray_push_back(rules->layoutInfos, p);    }    utarray_done(&toAdd);    FcitxXkbRulesFree(rulesextra);}
开发者ID:farseerfc,项目名称:fcitx,代码行数:30,


示例14: IsMouseInOtherMenu

boolean IsMouseInOtherMenu(XlibMenu *xlibMenu, int x, int y){    FcitxClassicUI *classicui = xlibMenu->parent.owner;    FcitxInstance* instance = classicui->owner;    FcitxUIMenu** menupp;    UT_array* uimenus = FcitxInstanceGetUIMenus(instance);    for (menupp = (FcitxUIMenu **) utarray_front(uimenus);            menupp != NULL;            menupp = (FcitxUIMenu **) utarray_next(uimenus, menupp)        ) {        XlibMenu* otherXlibMenu = (XlibMenu*)(*menupp)->uipriv[classicui->isfallback];        if (otherXlibMenu == xlibMenu)            continue;        XWindowAttributes attr;        XGetWindowAttributes(classicui->dpy, otherXlibMenu->parent.wId, &attr);        if (attr.map_state != IsUnmapped &&                FcitxUIIsInBox(x, y, attr.x, attr.y, attr.width, attr.height)) {            return true;        }    }    XlibMenu* otherXlibMenu = classicui->mainMenuWindow;    if (otherXlibMenu == xlibMenu)        return false;    XWindowAttributes attr;    XGetWindowAttributes(classicui->dpy, otherXlibMenu->parent.wId, &attr);    if (attr.map_state != IsUnmapped &&            FcitxUIIsInBox(x, y, attr.x, attr.y, attr.width, attr.height)) {        return true;    }    return false;}
开发者ID:ezc,项目名称:fcitx,代码行数:33,


示例15: ex_cmdinvert

void ex_cmdinvert(){  int st = compl_root_pos();  int ed = st;  while (ex.line[ed++] == ' ');  //FIXME: find compl_root_pos for curs position  Token *cur = cmdline_tokbtwn(&ex.cmd, st, ed);  Token *tok = (Token*)utarray_next(ex.cmd.tokens, cur);  char *symb = token_val(tok, VAR_STRING);  if (!cur)    return;  if (symb && *symb == '!') {    str_ins(ex.line, "", tok->start, 1);    ex.curofs--, ex.curpos--;  }  else {    str_ins(ex.line, "!", cur->end, 0);    ex.curofs++, ex.curpos++;  }  int old = ex.curofs;  ex.curofs = 0;  menu_rebuild(ex.menu);  ex.curofs = old;}
开发者ID:jollywho,项目名称:nav,代码行数:27,


示例16: ParsePlacement

void ParsePlacement(UT_array* sps, char* placment){    UT_array* array = SplitString(placment, ';');    char** str;    utarray_clear(sps);    for(str = (char**) utarray_front(array);        str != NULL;        str = (char**) utarray_next(array, str))    {        char* s = *str;        char* p = strchr(s, ':');        if (p == NULL)            continue;        if ((strchr(s, ':') - s) > MAX_STATUS_NAME)            continue;                int len = p - s;        SkinPlacement sp;        strncpy(sp.name, s, len);        sp.name[len] = '/0';        int ret = sscanf(p+1, "%d,%d", &sp.x, &sp.y);        if (ret != 2)            continue;        utarray_push_back(sps, &sp);    }        utarray_free(array);}
开发者ID:wengxt,项目名称:fcitx-skin-viewer,代码行数:28,


示例17: IsMouseInOtherMenu

boolean IsMouseInOtherMenu(XlibMenu *xlibMenu, int x, int y){    FcitxLightUI *lightui = xlibMenu->owner;    FcitxInstance* instance = lightui->owner;    FcitxUIMenu** menupp;    for (menupp = (FcitxUIMenu **) utarray_front(&instance->uimenus);            menupp != NULL;            menupp = (FcitxUIMenu **) utarray_next(&instance->uimenus, menupp)        )    {        XlibMenu* otherXlibMenu = (XlibMenu*) (*menupp)->uipriv;        if (otherXlibMenu == xlibMenu)            continue;        XWindowAttributes attr;        XGetWindowAttributes(lightui->dpy, otherXlibMenu->menuWindow, &attr);        if (attr.map_state != IsUnmapped &&                IsInBox(x, y, attr.x, attr.y, attr.width, attr.height))        {            return true;        }    }    XlibMenu* otherXlibMenu = lightui->mainMenuWindow;    if (otherXlibMenu == xlibMenu)        return false;    XWindowAttributes attr;    XGetWindowAttributes(lightui->dpy, otherXlibMenu->menuWindow, &attr);    if (attr.map_state != IsUnmapped &&            IsInBox(x, y, attr.x, attr.y, attr.width, attr.height))    {        return true;    }    return false;}
开发者ID:wengxt,项目名称:fcitx-ui-light,代码行数:35,


示例18: p_udi_args_init

/* * Here we initialize the arguments indexing */YAP_Intp_udi_args_init(Term spec, int arity, UdiInfo blk){	int i;	Term arg;	Atom idxtype;	UdiControlBlock *cb;	struct udi_p_args p_arg;	for (i = 1; i <= arity; i++) {		arg = ArgOfTerm(i,spec);		if (IsAtomTerm(arg)) {			idxtype = AtomOfTerm(arg);			if (idxtype == AtomMinus) //skip this argument				continue;			p_arg.control = NULL;			cb = NULL;			while ((cb = (UdiControlBlock *) utarray_next(indexing_structures, cb))) {				if (idxtype == (*cb)->decl){					p_arg.arg = i;					p_arg.control = *cb;					p_arg.idxstr = (*cb)->init(spec, i, arity);					utarray_push_back(blk->args, &p_arg);				}			}			if (p_arg.control == NULL){ /* not "-" and not found */				fprintf(stderr, "Invalid Spec (%s)/n", AtomName(idxtype));				return FALSE;			}		}	}	return TRUE;}
开发者ID:jfmc,项目名称:yap-6.3,代码行数:36,


示例19: param_find_changed

/** * Locate the modified parameter structure for a parameter, if it exists. * * @param param			The parameter being searched. * @return			The structure holding the modified value, or *				NULL if the parameter has not been modified. */static struct param_wbuf_s *param_find_changed(param_t param){	struct param_wbuf_s	*s = NULL;	param_assert_locked();	if (param_values != NULL) {#if 0	/* utarray_find requires bsearch, not available */		struct param_wbuf_s key;		key.param = param;		s = utarray_find(param_values, &key, param_compare_values);#else		while ((s = (struct param_wbuf_s *)utarray_next(param_values, s)) != NULL) {			if (s->param == param) {				break;			}		}#endif	}	return s;}
开发者ID:hopewhd,项目名称:Firmware,代码行数:32,


示例20: tiz_vector_find

OMX_PTRtiz_vector_find (const tiz_vector_t * p_vec, const OMX_PTR ap_data){  OMX_PTR p_next = NULL, p_cur = NULL;  assert (p_vec);  assert (ap_data);  for (;;)    {      p_next = utarray_next (p_vec->p_uta, p_cur);      if (NULL == p_next)        {          return NULL;        }      if (0 == memcmp (ap_data, p_next, p_vec->p_icd->sz))        {          return p_next;        }      p_cur = p_next;    }}
开发者ID:tizonia,项目名称:tizonia-openmax-il,代码行数:25,


示例21: main

int main() {  UT_array *a;  int i, *p;  utarray_new(a, &ut_int_icd);  for(i=0;i<10;i++) utarray_push_back(a,&i);  for(p=(int*)utarray_front(a); p; p=(int*)utarray_next(a,p)) printf("%d ",*p);   printf("/n");  printf("len: %u/n/n", utarray_len(a));    i=10; utarray_insert(a, &i, 10);  while ( (p=(int*)utarray_next(a,p))) printf("%d ", *p); printf("/n");  printf("len: %u/n/n", utarray_len(a));  utarray_free(a);  return 0;}
开发者ID:Agyar,项目名称:uthash,代码行数:16,


示例22: LuaCallCommand

static void* LuaCallCommand(void* arg, FcitxModuleFunctionArg args) {    LuaModule *luamodule = (LuaModule *)arg;    UT_array *result = InputCommand(luamodule, (const char *)args.args[0]);    if (result) {        FcitxInputState* input = FcitxInstanceGetInputState(GetFcitx(luamodule));        LuaResultItem *p = NULL;        while ((p = (LuaResultItem *)utarray_next(result, p))) {            FcitxCandidateWord candWord;            if (args.args[1] && args.args[2]) {                candWord.callback = args.args[1];                candWord.owner = args.args[2];            }            else {                candWord.callback = LuaGetCandWord;                candWord.owner = luamodule;            }            candWord.priv = p->help ? strdup(p->help) : NULL;            if (p->help || p->tip) {                asprintf(&candWord.strExtra, "%s%s%s", p->help ? p->help : "", p->help && p->tip ? " " : "", p->tip ? p->tip : "");            } else {                candWord.strExtra = NULL;            }            candWord.strWord = strdup(p->result);            candWord.wordType = MSG_TIPS;            candWord.extraType = MSG_CODE;            FcitxCandidateWordAppend(FcitxInputStateGetCandidateList(input), &candWord);        }        utarray_free(result);    }    return NULL;}
开发者ID:mylxiaoyi,项目名称:fcitx,代码行数:31,


示例23: drain_clients

void drain_clients() {  int rc, *fd, pos;  char buf[1024];  fd=NULL;  while ( (fd=(int*)utarray_next(cfg.fds,fd))) {    do {      rc = read(*fd, buf, sizeof(buf));      switch(rc) {         default: fprintf(stderr,"received %d bytes/n", rc);         break;        case  0: fprintf(stderr,"fd %d closed/n", *fd);             break;        case -1: if (errno == EWOULDBLOCK || errno == EAGAIN)       break;                 fprintf(stderr, "recv: %s/n", strerror(errno));    break;      }    } while(rc > 0);    if (rc==0) {      fprintf(stderr,"client %d has closed/n", *fd);      close(*fd);      *fd = -1; /* mark for cleanup after forward iteration */    }  }  /* cleanup any sockets that we closed, reverse iteration */  fd=NULL;  while ( (fd=(int*)utarray_prev(cfg.fds,fd))) {    pos = utarray_eltidx(cfg.fds,fd);    if (*fd == -1) utarray_erase(cfg.fds,pos,1);  }}
开发者ID:Low-power,项目名称:NetworkExamples,代码行数:31,


示例24: FcitxUILoad

FCITX_EXPORT_APIvoid FcitxUILoad(FcitxInstance* instance){    UT_array* addons = &instance->addons;    FcitxAddon *addon;    for (addon = (FcitxAddon *) utarray_front(addons);            addon != NULL;            addon = (FcitxAddon *) utarray_next(addons, addon)) {        if (addon->bEnabled && addon->category == AC_UI) {            if (FcitxUILoadInternal(instance, addon))                instance->uinormal = addon;            if (instance->uinormal != NULL)                break;        }    }    instance->ui = instance->uinormal;    if (instance->ui == NULL) {        FcitxLog(ERROR, "no usable user interface.");        return;    }    if (addon->uifallback)        instance->fallbackuiName = strdup(addon->uifallback);}
开发者ID:hiroshiyui,项目名称:fcitx,代码行数:28,


示例25: shift_buffers

// periodically we shift the output buffers down// to reclaim the already written output regionsvoid shift_buffers() {  int *fd=NULL, *i=NULL;  UT_string **s=NULL;  size_t len;  while ( (fd=(int*)utarray_next(cfg.clients,fd))) {    s=(UT_string**)utarray_next(cfg.outbufs,s); assert(s);    i=(int*)utarray_next(cfg.outidxs,i);        assert(i);    len = utstring_len(*s);    if (*i == 0) continue; // nothing to shift     assert(*i > 0);    memmove((*s)->d, (*s)->d + *i, len-*i);    (*s)->i -= *i;    *i = 0;  }}
开发者ID:JHUAPL,项目名称:kvspool,代码行数:19,


示例26: have_capacity

/* used to stop reading the spool when internal buffers are 90% full */int have_capacity() {  size_t max = utarray_len(cfg.outbufs) * cfg.mb_per_client * (1024*1024);  size_t used=0;  UT_string **s=NULL;  while ( (s=(UT_string**)utarray_next(cfg.outbufs,s))) used += utstring_len(*s);  double pct_full = max ? (used*100.0/max) : 100;  return (pct_full > 90) ? 0 : 1;}
开发者ID:JHUAPL,项目名称:kvspool,代码行数:9,


示例27: LightUICreate

void* LightUICreate(FcitxInstance* instance){    FcitxModuleFunctionArg arg;    FcitxLightUI* lightui = fcitx_utils_malloc0(sizeof(FcitxLightUI));    FcitxAddon* lightuiaddon = FcitxAddonsGetAddonByName(FcitxInstanceGetAddons(instance), FCITX_LIGHT_UI_NAME);    lightui->owner = instance;    if (!LoadLightUIConfig(lightui))    {        free(lightui);        return NULL;    }    lightui->dpy = InvokeFunction(instance, FCITX_X11, GETDISPLAY, arg);    if (lightui->dpy == NULL)    {        free(lightui);        return NULL;    }    lightui->isfallback = FcitxUIIsFallback(instance, lightuiaddon);    lightui->iScreen = DefaultScreen(lightui->dpy);    CreateFont(lightui);    lightui->protocolAtom = XInternAtom (lightui->dpy, "WM_PROTOCOLS", False);    lightui->killAtom = XInternAtom (lightui->dpy, "WM_DELETE_WINDOW", False);    /* Main Menu Initial */    FcitxMenuInit(&lightui->mainMenu);    FcitxUIMenu **menupp;    UT_array* uimenus = FcitxInstanceGetUIMenus(instance);    for (menupp = (FcitxUIMenu **) utarray_front(uimenus);            menupp != NULL;            menupp = (FcitxUIMenu **) utarray_next(uimenus, menupp)        )    {        FcitxUIMenu * menup = *menupp;        if (!menup->isSubMenu)            FcitxMenuAddMenuItem(&lightui->mainMenu, menup->name, MENUTYPE_SUBMENU, menup);    }    FcitxMenuAddMenuItem(&lightui->mainMenu, NULL, MENUTYPE_DIVLINE, NULL);    FcitxMenuAddMenuItem(&lightui->mainMenu, _("Configure"), MENUTYPE_SIMPLE, NULL);    FcitxMenuAddMenuItem(&lightui->mainMenu, _("Exit"), MENUTYPE_SIMPLE, NULL);    lightui->mainMenu.MenuAction = MainMenuAction;    lightui->mainMenu.priv = lightui;    lightui->mainMenu.mark = -1;    lightui->inputWindow = CreateInputWindow(lightui);    lightui->mainWindow = CreateMainWindow(lightui);    lightui->trayWindow = CreateTrayWindow(lightui);    lightui->mainMenuWindow = CreateMainMenuWindow(lightui);    FcitxIMEventHook resethk;    resethk.arg = lightui;    resethk.func = LightUIInputReset;    FcitxInstanceRegisterResetInputHook(instance, resethk);    return lightui;}
开发者ID:fcitx,项目名称:fcitx-ui-light,代码行数:58,


示例28: cmdline_tokbtwn

Token* cmdline_tokbtwn(Cmdline *cmdline, int st, int ed){  Token *word = NULL;  while ((word = (Token*)utarray_next(cmdline->tokens, word))) {    if (MAX(0, MIN(ed, word->end) - MAX(st, word->start)) > 0)      return word;  }  return NULL;}
开发者ID:jollywho,项目名称:nav,代码行数:9,


示例29: lines_count

static int lines_count(UT_array *lines, const char *type){    line_t *line = NULL;    int ret = 0;    while( (line = (line_t*)utarray_next(lines, line))) {        if (strncmp(line->type, type, 2) == 0)            ret++;    }    return ret;}
开发者ID:guillaumechereau,项目名称:goxel,代码行数:10,


示例30: dicom_import

void dicom_import(const char *dirpath){    DIR *dir;    struct dirent *dirent;    dicom_t dicom, *dptr;    static UT_icd dicom_icd = {sizeof(dicom_t), NULL, NULL, NULL};    UT_array *all_files;    int w, h, d;    // Dimensions of the full data cube.    int i;    uint16_t *data;    uvec4b_t *cube;    // First we parse all the dicom images into a sorted array.    // XXX: how to propery iter a directory?    utarray_new(all_files, &dicom_icd);    dir = opendir(dirpath);    while ((dirent = readdir(dir))) {        if (dirent->d_name[0] == '.') continue;        asprintf(&dicom.path, "%s/%s", dirpath, dirent->d_name);        dicom_load(dicom.path, &dicom, NULL, 0);        CHECK(dicom.rows && dicom.columns);        utarray_push_back(all_files, &dicom);    }    closedir(dir);    utarray_sort(all_files, dicom_sort);    // Read all the file data one by one into the data cube.    w = dicom.columns;    h = dicom.rows;    d = utarray_len(all_files);    data = calloc(w * h * d, 2);    dptr = NULL;    while( (dptr = (dicom_t*)utarray_next(all_files, dptr))) {        i = utarray_eltidx(all_files, dptr);        dicom_load(dptr->path, &dicom,                   (char*)&data[w * h * i], w * h * 2);        free(dptr->path);    }    utarray_free(all_files);    // Generate 4 * 8bit RGBA values.    // XXX: we should maybe support voxel data in 2 bytes monochrome.    cube = malloc(w * h * d * sizeof(*cube));    for (i = 0; i < w * h * d; i++) {        cube[i] = uvec4b(255, 255, 255, clamp(data[i], 0, 255));    }    free(data);    // This could belong to the caller function.    mesh_blit(goxel()->image->active_layer->mesh, cube,              -w / 2, -h / 2, -d / 2, w, h, d);    free(cube);}
开发者ID:MyOwnClone,项目名称:goxel,代码行数:55,



注:本文中的utarray_next函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ utarray_push_back函数代码示例
C++ utarray_new函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。