• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: do_controller_flush_cmd

bool do_controller_flush_cmd(int argc, char *argv[]) {
    chunk_ptr msg = msg_new_flush();
    word_t w;
    int fd;
    bool ok = true;
    set_iterstart(worker_fd_set);
    while (set_iternext(worker_fd_set, &w)) {
	fd = w;
	if (!chunk_write(fd, msg)) {
	    err(false,
		"Failed to send flush message to worker with descriptor %d", fd);
	    ok = false;
	}
    }
    set_iterstart(client_fd_set);
    while (set_iternext(client_fd_set, &w)) {
	fd = w;
	if (!chunk_write(fd, msg)) {
	    err(false,
		"Failed to send flush message to client with descriptor %d", fd);
	    ok = false;
	}
    }
    chunk_free(msg);
    free_global_ops();
    gc_state = GC_READY;
    need_worker_cnt = 0;
    if (need_client_fd_set != NULL)
	set_free(need_client_fd_set);
    need_client_fd_set = NULL;
    if (defer_client_fd_set != NULL)
	set_free(defer_client_fd_set);
    defer_client_fd_set = NULL;
    return ok;
}
开发者ID:rebryant,项目名称:Cloud-BDD,代码行数:35,代码来源:controller.c


示例2: set_new

static Set *new_matches(void) {
        Set *set;
        char *tmp;
        int r;

        set = set_new(trivial_hash_func, trivial_compare_func);
        if (!set) {
                log_oom();
                return NULL;
        }

        tmp = strdup("MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
        if (!tmp) {
                log_oom();
                set_free(set);
                return NULL;
        }

        r = set_consume(set, tmp);
        if (r < 0) {
                log_error("failed to add to set: %s", strerror(-r));
                set_free(set);
                return NULL;
        }

        return set;
}
开发者ID:gcampax,项目名称:systemd,代码行数:27,代码来源:coredumpctl.c


示例3: ddf_CheckEmptiness

ddf_boolean ddf_CheckEmptiness(ddf_PolyhedraPtr poly, ddf_ErrorType *err)
{
  ddf_rowset R, S;
  ddf_MatrixPtr M=NULL;
  ddf_boolean answer=ddf_FALSE;

  *err=ddf_NoError;

  if (poly->representation==ddf_Inequality){
	M=ddf_CopyInequalities(poly);
	set_initialize(&R, M->rowsize);
	set_initialize(&S, M->rowsize);
	if (!ddf_ExistsRestrictedFace(M, R, S, err)){
	  poly->child->CompStatus=ddf_AllFound;
	  poly->IsEmpty=ddf_TRUE;
	  poly->n=0;
	  answer=ddf_TRUE;
	}
	set_free(R);
	set_free(S);
	ddf_FreeMatrix(M);
  } else if (poly->representation==ddf_Generator && poly->m<=0){
	*err=ddf_EmptyVrepresentation;
	poly->IsEmpty=ddf_TRUE;
	poly->child->CompStatus=ddf_AllFound;
	answer=ddf_TRUE;
	poly->child->Error=*err;  
  }
  
  return answer;
开发者ID:adsnaider,项目名称:Robotics-Project,代码行数:30,代码来源:cddlib_f.c


示例4: test_communicate

void
test_communicate() {
    int valuebuf[] = { 1 };
    size_t i;
    ListObject *lp = list_new();
    for(i = 0; i < 10; i++) {
        *valuebuf = i;
        list_add(lp, valuebuf);
    }
    ListObject *lp2 = list_new();
    for(i = 5; i < 15; i++) {
        *valuebuf = i;
        list_add(lp2, valuebuf);
    }
    printf("list1 is:\n");
    list_print(lp);
    printf("list2 is:\n");
    list_print(lp2);
    SetObject *sp = set_fromlist(lp, int_hash, lp->keycmp, lp->keydup, 0);
    printf("set from  list1 is:\n");
    set_print_int(sp);
    SetObject *sp2 = set_fromlist(lp2, int_hash, lp2->keycmp, lp2->keydup, 0);
    printf("set from  list2 is:\n");
    set_print_int(sp2);
    printf("so, intersection of the two list is\n");
    set_print_int(set_and(sp, sp2));
    list_free(lp);
    list_free(lp2);
    set_free(sp);
    set_free(sp2);
}
开发者ID:pronan,项目名称:c_data_structures,代码行数:31,代码来源:main.c


示例5: exit_status_set_free

void exit_status_set_free(ExitStatusSet *x) {
        assert(x);

        set_free(x->status);
        set_free(x->signal);
        x->status = x->signal = NULL;
}
开发者ID:275288698,项目名称:systemd-ubuntu-with-dbus,代码行数:7,代码来源:exit-status.c


示例6: test_set

static void
test_set(void) {
    char *keys1[] = {"a", "b", "r", "a", "c", "a", "d", "a", "b", "r", "a"};
    char *keys2[] = {"a", "l", "a", "c", "a", "z", "a", "m"};
    SetObject *a = set_new();
    SetObject *b = set_new();
    set_addfrom(a, (void**)keys1, 11);
    set_addfrom(b, (void**)keys2, 8);
    set_print(a); // { 'c', 'd', 'r', 'a', 'b', }
    set_print(b); // { 'c', 'l', 'm', 'a', 'z', }
    set_print(set_rsub(a, b)); //{ 'd', 'b', 'r', }
    set_print(set_ror(a, b)); //{ 'a', 'b', 'c', 'd', 'l', 'm', 'r', 'z', }
    set_print(set_rand(a, b)); //{ 'c', 'a', }
    set_print(set_rxor(a, b)); //{ 'b', 'd', 'l', 'm', 'r', 'z', }
    set_ior(a, b);
    set_print(a);
    set_isub(a, b);
    set_print(a);
    set_ixor(a, b);
    set_print(a);
    set_iand(a, b);
    set_print(a);
    set_free(a);
    set_free(b);
    char *keys3[] = {"a", "b"};
    char *keys4[] = {"a", "b", "d", "c", "e", "f", "g", "h"};
    SetObject *c = set_new();
    SetObject *d = set_new();
    set_addfrom(c, (void**)keys3, 2);
    set_addfrom(d, (void**)keys4, 8);
    set_print(set_xor(c, d));
    set_print(set_and(c, d));
    set_print(set_sub(c, d));
}
开发者ID:pronan,项目名称:c_data_structures,代码行数:34,代码来源:main.c


示例7: set_new

static Set *new_matches(void) {
        Set *set;
        char *tmp;
        int r;

        set = set_new(NULL);
        if (!set) {
                log_oom();
                return NULL;
        }

        tmp = strdup("MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1");
        if (!tmp) {
                log_oom();
                set_free(set);
                return NULL;
        }

        r = set_consume(set, tmp);
        if (r < 0) {
                log_error_errno(r, "failed to add to set: %m");
                set_free(set);
                return NULL;
        }

        return set;
}
开发者ID:ringlej,项目名称:systemd,代码行数:27,代码来源:coredumpctl.c


示例8: set_new

Set *set_union(Set *set1, Set *set2)
{
	SetIterator iterator;
	Set *new_set;
	SetValue value;

	new_set = set_new(set1->hash_func, set1->equal_func);

	if (new_set == NULL) {
		return NULL;
	}

	/* Add all values from the first set */
	
	set_iterate(set1, &iterator);

	while (set_iter_has_more(&iterator)) {

		/* Read the next value */

		value = set_iter_next(&iterator);

		/* Copy the value into the new set */

		if (!set_insert(new_set, value)) {

			/* Failed to insert */
			
			set_free(new_set);
			return NULL;
		}
	}
	
	/* Add all values from the second set */
	
	set_iterate(set2, &iterator);

	while (set_iter_has_more(&iterator)) {

		/* Read the next value */

		value = set_iter_next(&iterator);

		/* Has this value been put into the new set already? 
		 * If so, do not insert this again */

		if (set_query(new_set, value) == 0) {
			if (!set_insert(new_set, value)) {

				/* Failed to insert */

				set_free(new_set);
				return NULL;
			}
		}
	}

	return new_set;
}
开发者ID:hexforge,项目名称:pulp_db,代码行数:59,代码来源:set.c


示例9: test_set_intersection

void test_set_intersection (void) {
  int numbers1[] = {1, 2, 3, 4, 5, 6, 7};
  int numbers2[] = {5, 6, 7, 8, 9, 10, 11};
  int result[] = {5, 6, 7};
  int i;
  Set* set1;
  Set* set2;
  Set* result_set;
  size_t allocated;

  /* Create the first set */

  set1 = set_new (int_hash, int_equal);

  for (i = 0; i < 7; ++i) {
    set_insert (set1, &numbers1[i]);
    }

  /* Create the second set */

  set2 = set_new (int_hash, int_equal);

  for (i = 0; i < 7; ++i) {
    set_insert (set2, &numbers2[i]);
    }

  /* Perform the intersection */

  result_set = set_intersection (set1, set2);

  assert (set_num_entries (result_set) == 3);

  for (i = 0; i < 3; ++i) {
    assert (set_query (result_set, &result[i]) != 0);
    }

  /* Test out of memory scenario */

  alloc_test_set_limit (0);
  assert (set_intersection (set1, set2) == NULL);

  /* Can allocate set, can't copy all values */

  alloc_test_set_limit (2 + 2);
  allocated = alloc_test_get_allocated();
  assert (set_intersection (set1, set2) == NULL);
  assert (alloc_test_get_allocated() == allocated);

  set_free (set1);
  set_free (set2);
  set_free (result_set);
  }
开发者ID:dlove24,项目名称:dl-calg,代码行数:52,代码来源:test-set.c


示例10: set_test

void
set_test()
{
	printf("SET S: ");
	set* s = set_init();
	set_add(s, (SETDATA*)1);
	set_add(s, (SETDATA*)2);
	set_add(s, (SETDATA*)3);
	set_add(s, (SETDATA*)4);
	set_add(s, (SETDATA*)5);
	set_add(s, (SETDATA*)6);
	set_print(s, set_testcb);

	printf("S \\ 2, 6: ");
	set_remove(s, (SETDATA*)6);
	set_remove(s, (SETDATA*)2);
	set_print(s, set_testcb);
	
	printf("SET T: ");
	set* t = set_init();
	set_add(t, (SETDATA*)1);
	set_add(t, (SETDATA*)2);
	set_add(t, (SETDATA*)9);
	set_add(t, (SETDATA*)4);
	set_print(t, set_testcb);
	
	printf("UNION OF S, T: ");
	set* u = set_init();
	set_union(u, s, t);
	set_print(u, set_testcb);
	
	printf("INTERSECTION OF S, T: ");
	set* i = set_init();
	set_intersection(i, s, t);
	set_print(i, set_testcb);
	
	printf("DIFFERENCE OF S, T: ");
	set* d = set_init();
	set_difference(d, s, t);
	set_print(d, set_testcb);
	
	printf("CLEAR S: ");
	set_clear(s);
	set_print(s, set_testcb);
	
	set_free(s);
	set_free(t);
	set_free(u);
	set_free(i);
	set_free(d);
}
开发者ID:Zugamifk,项目名称:fishermans,代码行数:51,代码来源:set.c


示例11: validate_free

static void validate_free(validate_type * validate) {
  if (validate->common_selection_set != NULL) set_free(validate->common_selection_set);
  if (validate->indexed_selection_set != NULL) {
    for (int i = 0; i < validate->argc_max; i++)
      if (validate->indexed_selection_set[i] != NULL)
        set_free(validate->indexed_selection_set[i]);
    free(validate->indexed_selection_set);
  }
  
  int_vector_free( validate->type_map );
  if (validate->required_children != NULL) stringlist_free(validate->required_children);
  if (validate->required_children_value != NULL) hash_free(validate->required_children_value);
  free(validate);
}
开发者ID:JacobStoren,项目名称:ert,代码行数:14,代码来源:config_schema_item.c


示例12: split_item

void split_item(item_p i, size_t size) {
    if (block_size(i) <= size)
        return;
    item_p j = get_unmatched_item();
    if (j == NULL)
        return;
    j->size = block_size(i) - size;
    i->size = size;
    set_free(i); set_free(j);
    j->data = i->data + size;
    j->next = i->next;
    i->next = j;
    freeblks++;
}
开发者ID:Elizaveta239,项目名称:malloc,代码行数:14,代码来源:selfcompact.cpp


示例13: automount_done

static void automount_done(Unit *u) {
        Automount *a = AUTOMOUNT(u);

        assert(a);

        unmount_autofs(a);

        a->where = mfree(a->where);

        a->tokens = set_free(a->tokens);
        a->expire_tokens = set_free(a->expire_tokens);

        a->expire_event_source = sd_event_source_unref(a->expire_event_source);
}
开发者ID:aulanov,项目名称:systemd,代码行数:14,代码来源:automount.c


示例14: context_free

static void context_free(Context *context) {
        sd_event_source *es;
        Connection *c;

        assert(context);

        while ((es = set_steal_first(context->listen)))
                sd_event_source_unref(es);

        while ((c = set_first(context->connections)))
                connection_free(c);

        set_free(context->listen);
        set_free(context->connections);
}
开发者ID:ariscop,项目名称:systemd,代码行数:15,代码来源:socket-proxyd.c


示例15: word_adds_find_dupes

/* 0 files to go -> "0s " */
TEST word_adds_find_dupes() {
    set *s = set_new(2, dumb_hash, cmp);
    int duplicates[word_count];
    bzero(duplicates, word_count * sizeof(int));

    for (int i=0; i<word_count; i++) {
        char *w = words[i];
        ASSERT(w);
        if (set_known(s, w)) {
            duplicates[i] = 1;
        } else {
            if (set_store(s, (void *) w) == TABLE_SET_FAIL) FAIL();
        }
    }

    for (int i=0; i<word_count; i++) {
        if (0) printf("%d - %s %d\n", i, words[i], duplicates[i]);
    }

    for (int i=0; i<18; i++) {
        ASSERT_EQm("none of the first 18 are duplicates", 0, duplicates[i]);
    }

    ASSERT_EQm("words[19] (\"onion\") is a dup", 1, duplicates[19]);
    ASSERT_EQm("the last word (\"fennel\") is a dup", 1, duplicates[word_count - 1]);

    set_free(s, NULL);
    PASS();
}
开发者ID:hoyeonKim,项目名称:glean,代码行数:30,代码来源:test_set.c


示例16: mem_get

long  mem_get(long request){
	long l = request;
	long lidx = 0;
	long idx = 2;

	while(idx != 0){
		if(get_length(idx) >= l && get_free(idx)){
			/* Gat gevonden waar de aanvraag in past. */
			lidx = idx;
			l = get_length(idx);
			break;
		}
		
		idx = get_next(idx);
	}
	
	if(lidx == 0){
		/* Geen gat groot genoeg. */
		return -1;
	}else if(l == request){
		/* Gat precies groot genoeg. */
		mem[0] += request;
		mem[1] += ADMIN_SIZE;
		set_free(lidx, 0);
		return lidx + ADMIN_SIZE;
	}else{
		/* Alleen een gat > request. */
		return split_block(lidx, request);
	}
}
开发者ID:TomPeerdeman,项目名称:OS2012,代码行数:30,代码来源:first-fit.c


示例17: broadcast_signal

void broadcast_signal(int sig, bool wait_for_exit) {
        sigset_t mask, oldmask;
        Set *pids = NULL;

        if (wait_for_exit)
                pids = set_new(trivial_hash_func, trivial_compare_func);

        assert_se(sigemptyset(&mask) == 0);
        assert_se(sigaddset(&mask, SIGCHLD) == 0);
        assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) == 0);

        if (kill(-1, SIGSTOP) < 0 && errno != ESRCH)
                log_warning("kill(-1, SIGSTOP) failed: %m");

        killall(sig, pids);

        if (kill(-1, SIGCONT) < 0 && errno != ESRCH)
                log_warning("kill(-1, SIGCONT) failed: %m");

        if (wait_for_exit)
                wait_for_children(pids, &mask);

        assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) == 0);

        set_free(pids);
}
开发者ID:kwirk,项目名称:systemd,代码行数:26,代码来源:killall.c


示例18: fdset_new_listen_fds

int fdset_new_listen_fds(FDSet **_s, bool unset) {
        int n, fd, r;
        FDSet *s;

        assert(_s);

        /* Creates an fdset and fills in all passed file descriptors */

        s = fdset_new();
        if (!s) {
                r = -ENOMEM;
                goto fail;
        }

        n = sd_listen_fds(unset);
        for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++) {
                r = fdset_put(s, fd);
                if (r < 0)
                        goto fail;
        }

        *_s = s;
        return 0;


fail:
        if (s)
                set_free(MAKE_SET(s));

        return r;
}
开发者ID:pwaller,项目名称:systemd,代码行数:31,代码来源:fdset.c


示例19: ddf_InitialDataSetup

void ddf_InitialDataSetup(ddf_ConePtr cone)
{
  long j, r;
  ddf_rowset ZSet;
  static ddf_Arow Vector1,Vector2;
  static ddf_colrange last_d=0;

  if (last_d < cone->d){
    if (last_d>0) {
    for (j=0; j<last_d; j++){
      ddf_clear(Vector1[j]);
      ddf_clear(Vector2[j]);
    }
    free(Vector1); free(Vector2);
    }
    Vector1=(myfloat*)calloc(cone->d,sizeof(myfloat));
    Vector2=(myfloat*)calloc(cone->d,sizeof(myfloat));
    for (j=0; j<cone->d; j++){
      ddf_init(Vector1[j]);
      ddf_init(Vector2[j]);
    }
    last_d=cone->d;
  }

  cone->RecomputeRowOrder=ddf_FALSE;
  cone->ArtificialRay = NULL;
  cone->FirstRay = NULL;
  cone->LastRay = NULL;
  set_initialize(&ZSet,cone->m);
  ddf_AddArtificialRay(cone);
  set_copy(cone->AddedHalfspaces, cone->InitialHalfspaces);
  set_copy(cone->WeaklyAddedHalfspaces, cone->InitialHalfspaces);
  ddf_UpdateRowOrderVector(cone, cone->InitialHalfspaces);
  for (r = 1; r <= cone->d; r++) {
    for (j = 0; j < cone->d; j++){
      ddf_set(Vector1[j], cone->B[j][r-1]);
      ddf_neg(Vector2[j], cone->B[j][r-1]);
    }
    ddf_Normalize(cone->d, Vector1);
    ddf_Normalize(cone->d, Vector2);
    ddf_ZeroIndexSet(cone->m, cone->d, cone->A, Vector1, ZSet);
    if (set_subset(cone->EqualitySet, ZSet)){
      if (ddf_debug) {
        fprintf(stderr,"add an initial ray with zero set:");
        set_fwrite(stderr,ZSet);
      }
      ddf_AddRay(cone, Vector1);
      if (cone->InitialRayIndex[r]==0) {
        ddf_AddRay(cone, Vector2);
        if (ddf_debug) {
          fprintf(stderr,"and add its negative also.\n");
        }
      }
    }
  }
  ddf_CreateInitialEdges(cone);
  cone->Iteration = cone->d + 1;
  if (cone->Iteration > cone->m) cone->CompStatus=ddf_AllFound; /* 0.94b  */
  set_free(ZSet);
开发者ID:adsnaider,项目名称:Robotics-Project,代码行数:59,代码来源:cddlib_f.c


示例20: set_prod_free

/* ------------------------------------------------------------------------- 
 * --- set_free                 
 * -------------------------------------------------------------------------
 */
static void set_prod_free(Set* set)
{
   assert(set_prod_is_valid(set));

   set_free(set->prod.set_a);
   set_free(set->prod.set_b);

   set->head.refc--;

   if (set->head.refc == 0)
   {
      SID_del2(set->prod);
      
      free(set);
   }
}
开发者ID:bubuker,项目名称:keggle_santa,代码行数:20,代码来源:setprod.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_freezable函数代码示例发布时间:2022-05-30
下一篇:
C++ set_format函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap