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

C++ destroy_list函数代码示例

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

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



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

示例1: main

int main()
{
	slist_t *head = NULL, *tail = NULL;
	size_t list_size = 0;
	int i, ret;
	time_t t;

	time (&t);

	srand (t);

	for (i = 13; i > 0; i--) {
		ret = insert_at_head (&head, &tail, &list_size, (rand() % 10));
		if (ret < 0) {
			destroy_list (&head, &tail);
			return -1;
		}
	}

	print_list (&head);

	delete_duplicates (&head, &list_size);

	print_list (&head);

	destroy_list (&head, &tail);

	print_list (&head);

	return 0;
}
开发者ID:mchoube,项目名称:learnCoding,代码行数:31,代码来源:singly_linked_list_quiz_2.c


示例2: main

int main() {
	
	hash_table_t* people = hash_table_init(100);
	
	entry_t oliv = { "Pinon", "Olivier", "01 02 03 04", "Paris" };
	entry_t pa = { "Durand", "Pierre-Alexandre", "33 04 10", "Lyon" };

	printf("Does string equality work ? %d\n", eq_str(pa.name, "Durand"));

	hash_table_insert( people, &oliv );
	hash_table_insert( people, &pa );

	hash_table_print( people );

	list_t test = hash_table_find_by_name(people, "Durand");
	printf("%s\n   ", "Is M.Durand here ?");
	print_list(test);
	destroy_list(test);

	test = hash_table_find_by_surname(people, "Pierre-Alexandre");
	printf("%s\n   ", "Is Pierre-Alexandre here ?");
	print_list(test);
	destroy_list(test);

	printf("hash map test done\n");
	hash_table_print(people);

	hash_table_destroy( people );

	return 0;
};
开发者ID:oPinon,项目名称:Repertoire,代码行数:31,代码来源:hash_map_test.c


示例3: disconnect

/***************************************************************************
 * Function: void disconnect(conn_data *conn)
 *
 * Description:
 *   Remove the indicated connection from the list of connections,
 * close the file descriptor associated with it, and free all of the
 * memory it's using (including dereferencing of any strings still in
 * its input and output lists).
 **************************************************************************/
void disconnect(conn_data *conn) {
  find_data(conn_list, conn, ptrcmp, TRUE);
  close(conn->fd);
  destroy_list(conn->input, deref_string);
  destroy_list(conn->output, deref_string);
  free(conn);
}
开发者ID:herrevilkitten,项目名称:the_weave_mud,代码行数:16,代码来源:sockets.c


示例4: release_parser

void release_parser(parser_t* p)
{
	destroy_list(p->ast->function_list);
	destroy_list(p->ast->statement_list);
	free(p->ast);
	release_tokenizer(p->t);
	free(p->t);
}
开发者ID:cenan,项目名称:betik,代码行数:8,代码来源:parser.c


示例5: find_and_report

list_t* find_and_report(const char* datafile, const char mode, int pkgc, list_t* argv)
{
	// set quiet to avoid print results of search_record()
	unsigned short int hold_quiet=quiet;
	quiet = 1;

	int i=0;
	int found = 0;
	unsigned short int fcount = 0;
	unsigned short int mcount = 0;
	
	list_t* founded = new_list(0);
	list_t* missing = new_list(0);
	
	for (i=0; i<pkgc; i++)
	{	
		char* pkg  = get_list(argv,i);
		char buf[1024];
		strcpy(buf, pkg);
		
		char* tk = strtok(buf, "|");
		while(tk != NULL)
		{
			found = 0;
			if(search_record(datafile, tk))
			{
				found = 1;
				break;
			}
			tk = strtok(NULL, " ,");
		}
	
		if(found == 1)
		{
			fcount = fcount+1;
			resize_list(founded,fcount);
			add_list(founded,fcount-1,tk);
		} else {
			mcount = mcount+1;
			resize_list(missing,mcount);
			add_list(missing,mcount-1,pkg);
		}
	}
	quiet = hold_quiet;
	
	switch(mode)
	{
		case 'f' :
			return(founded);
		case 'm' :
			return(missing);
	}
	
	destroy_list(founded);
	destroy_list(missing);
	return(NULL);
}
开发者ID:Vacteria,项目名称:vpm,代码行数:57,代码来源:depends.c


示例6: destroy_list

void destroy_list(pointer P)
{
    if(is_type(P, DT_Pair))
    {
        if(pair_car(P) != NIL)
            destroy_list(pair_car(P));
        if(pair_cdr(P) != NIL)
            destroy_list(pair_cdr(P));
    }
    ploy_free(P);
}
开发者ID:Arelius,项目名称:ploy,代码行数:11,代码来源:types.cpp


示例7: destroy

static void
destroy(void) {
    if (init_avps)
        destroy_list(init_avps);

    if (start_avps)
        destroy_list(start_avps);

    if (stop_avps)
        destroy_list(stop_avps);
}
开发者ID:OpenSIPS,项目名称:opensips,代码行数:11,代码来源:call_control.c


示例8: destroy

static void
destroy(void) {
	if (cc_init_avps)
		destroy_list(cc_init_avps);

	if (cc_start_avps)
		destroy_list(cc_start_avps);

	if (cc_stop_avps)
		destroy_list(cc_stop_avps);
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:11,代码来源:call_control.c


示例9: destroy_function

void destroy_function(function_p f) {
	if(f != NULL) {
		if(f->desc != NULL) {
			destroy_list(f->desc);
		}
		if(f->params != NULL) {
			destroy_list(f->params);
		}
		free(f);
	}
}
开发者ID:gitter-badger,项目名称:rpgxEF,代码行数:11,代码来源:export_lyx.c


示例10: ds_destroy_list

/*called from dispatcher.c: free all*/
int ds_destroy_list(void)
{
	if (ds_lists) {
		destroy_list(0);
		destroy_list(1);
		shm_free(ds_lists);
	}

	if (crt_idx)
		shm_free(crt_idx);

	return 0;
}
开发者ID:MayamaTakeshi,项目名称:opensips,代码行数:14,代码来源:dispatch.c


示例11: destroy_list

void destroy_list (Node *n)
{
    
    if (isNil(n))
	;
    else if (isAtom(n)){
	free(atomVal(n)); /* free the atom here */
        free_node(n);
    } else {
	destroy_list(car(n));
	destroy_list(cdr(n));
	free_node(n);
    }
}
开发者ID:nathanhaigh,项目名称:staden-trunk,代码行数:14,代码来源:list.c


示例12: destroy_value

static void destroy_value(struct lp_value *v) {
  int d;
  switch(v->t) {
  case S:
    free(v->v.s); 
    break;
    
  case LIST:
    destroy_list(v->v.l);
    break;
    
  case I: 
  case D: break;

  case TOPOSPEC:
    for(d = 0; d < v->v.t.len; d++)
      destroy_topospec(&v->v.t.l[d]);

    free(v->v.t.l);
    break;
      
  default:
    destroy_block(v->v.b);
  }

  free(v);
}
开发者ID:Vivien-Michel,项目名称:PFSsim,代码行数:27,代码来源:util.c


示例13: get_cpu_load_atomic

float
get_cpu_load_atomic(void)
{
    char buf[MAXLINE];
    char c;
    char **list;
    int i, statfd;
    unsigned long total_time, idle_time;
    float idle_pct;

    while ((statfd = open("/proc/stat", O_RDONLY)),statfd == -1 && errno == EINTR)
        ;
    if (statfd == -1) {
        perror("Failed to read /proc/stat");
        return -1;
    }

    i = 0;
    while ((read(statfd, &c, 1) != -1) && c != '\n')
        buf[i++] = c;
    buf[i] = 0;

    list = string_to_list(buf, " ");

    total_time = 0;
    idle_time = atol(list[4]);
    for (i = 1; list[i] != 0; i++)
        total_time += atol(list[i]);
    
    idle_pct = ((float)idle_time/(float)total_time) * 100;
    destroy_list((void **)list);

    return idle_pct;
}
开发者ID:abhijat,项目名称:HindSight,代码行数:34,代码来源:triggers.c


示例14: main

int main(int argc, char *argv[])
{
  list l = new_list(sizeof(int), NULL, NULL);
  int x = 10;
  int y = 11;
  int z = 12;
  app_to_list(l, &x);
  prep_to_list(l, &y);
  printf("\n");

  map_list(l, print);
  printf("\n");

  map_list(l, addTwo);

  map_list(l, print);
  printf("\n");

  map_compare_del(l, compareInts, &z);

  map_list(l, print);
  printf("\n");

  app_to_list(l, &x);
  prep_to_list(l, &y);  
  
  map_list(l, print);
  printf("\n");

  destroy_list(l);
  return 0;
}
开发者ID:Tw1stedL0gic,项目名称:IOOPM-jojoca,代码行数:32,代码来源:listTest.c


示例15: list_pipe

ListType* list_pipe(ListType* l, int type, int pipe_op, int rm_l) {
    ListType* newl = (ListType*)malloc(sizeof(ListType));
    newl->list = NULL;
    newl->type = type;
    int len = g_list_length(l->list);
    int i;
    for(i=0; i<len; i++) {
        switch(type) {
        case EDGE_T:
            if(pipe_op==OP_OUTE)
                newl = list_append_gl(newl, ((VertexType*)g_list_nth_data(l->list, i))->outEdges, EDGE_T);
            else if(pipe_op==OP_INE)
                newl = list_append_gl(newl, ((VertexType*)g_list_nth_data(l->list, i))->inEdges, EDGE_T);
            else
                die(-1,"illegal pipe op for vlist\n");
            break;
        case VERTEX_T:
            if(pipe_op==OP_SV)
                newl = list_append(newl, VERTEX_T, ((EdgeType*)g_list_nth_data(l->list, i))->start);
            else if(pipe_op==OP_EV)
                newl = list_append(newl, VERTEX_T, ((EdgeType*)g_list_nth_data(l->list, i))->end);
            else
                die(-1,"illegel pipe op for elist\n");
            break;
        default:
            die(-1,"illegal pipe type \n");
        }
    }
    if(rm_l == FLAG_DESTROY_ATTR)destroy_list(l);
    return newl;
}
开发者ID:norman0612,项目名称:NSBL_gcDev,代码行数:31,代码来源:Derivedtype.c


示例16: event_record_start_trap

static void event_record_start_trap(WORD addr, void *data)
{
    switch (event_start_mode) {
      case EVENT_START_MODE_FILE_SAVE:
        if (machine_write_snapshot(event_snapshot_path(event_start_snapshot),
                                    1, 1, 0) < 0) {
#ifdef HAS_TRANSLATION
            ui_error(translate_text(IDGS_CANT_CREATE_START_SNAP_S), 
#else
            ui_error(_("Could not create start snapshot file %s."), 
#endif
                        event_snapshot_path(event_start_snapshot));
            ui_display_recording(0);
            return;
        }
        destroy_list();
        create_list();
        record_active = 1;
        event_initial_write();
        next_timestamp_clk = maincpu_clk;
        current_timestamp = 0;
        break;
      case EVENT_START_MODE_FILE_LOAD:
        if (machine_read_snapshot(
                event_snapshot_path(event_end_snapshot), 1) < 0) {
#ifdef HAS_TRANSLATION
            ui_error(translate_text(IDGS_ERROR_READING_END_SNAP_S),
#else
            ui_error(_("Error reading end snapshot file %s."),
#endif
                        event_snapshot_path(event_end_snapshot));
            return;
        }
开发者ID:martinpiper,项目名称:VICE,代码行数:33,代码来源:event.c


示例17: run_grammar

void run_grammar(tx_grammar_literal *lit) {
  size_t i;
  int row, col;
  pixel px;
  tx_grammar_literal *chosen = NULL;
  tx_grammar_expansion_site *ges = NULL;
  // Create a list of expansion sites:
  list *expansion_sites = create_list();
  // Start by loading our source file into our result texture and calling our
  // pre-processing filter if we have one:
  if (lit->filename == NULL) {
    if (lit->anchor_x == 0 || lit->anchor_y == 0) {
      fprintf(
        stderr,
        "Error: grammar with NULL filename must have nonzero anchor values.\n"
      );
      fprintf(stderr, "(found: %zu, %zu)\n", lit->anchor_x, lit->anchor_y);
      exit(EXIT_FAILURE);
    }
    lit->result = create_texture(lit->anchor_x, lit->anchor_y);
  } else {
    lit->result = load_texture_from_png(lit->filename);
  }
  if (lit->preprocess != NULL) {
    (*(lit->preprocess))(lit->result, lit->preargs);
  }
  // Now expand each child reference at random. Note that due to the low
  // resolution of the pseudo-random process, any item with a weight of less
  // than 1/65536th of the total weight of all items in a disjunction will
  // never be picked.
  for (col = 0; col < lit->result->width; ++col) {
    for (row = 0; row < lit->result->height; ++row) {
      px = tx_get_px(lit->result, col, row);
      for (i = 0; i < N_GRAMMAR_KEYS; ++i) {
        if (px == GRAMMAR_KEYS[i] && lit->children[i] != NULL) {
          chosen = choose_child(
            lit->children[i],
            hash_3d(hash_2d(hash_1d((ptrdiff_t) lit), i), col, row)
          );
          if (chosen->result == NULL) {
            run_grammar(chosen);
          }
          ges = create_expansion_site();
          ges->col = col;
          ges->row = row;
          ges->literal = chosen;
          l_append_element(expansion_sites, ges);
          ges = NULL; // destroy_list later on takes care of the memory used.
        }
      }
    }
  }
  l_witheach(expansion_sites, (void *) lit, expand_literal_into);
  // Clean up our list of expansion sites:
  destroy_list(expansion_sites);
  // Before wrapping up call our post-processing function if it exists:
  if (lit->postprocess != NULL) {
    (*(lit->postprocess))(lit->result, lit->postargs);
  }
}
开发者ID:solsword,项目名称:elf_forest,代码行数:60,代码来源:txgen.c


示例18: main

int main()
{
  init();
  show_main_window();
  app_event_loop();
  destroy_list(AccelLogging);
}
开发者ID:PGestewitz,项目名称:Mousetrap-Car,代码行数:7,代码来源:main.c


示例19: main

int main(void) {

	list *lista;

	lista = init_list();
	if(lista == NULL) {
		fprintf(stderr,"Can't create de list");
		return -1;
	}

	push(lista,1);
	push(lista,2);
	push(lista,3);
	push(lista,4);

	insert_after(lista,3,10);

	printf("POP: %i\n",pop(lista));
	printf("POP: %i\n",pop(lista));

	print_list(lista);

	destroy_list(lista);
	return 0;
}
开发者ID:gtzgileta,项目名称:ITESO_Sockets,代码行数:25,代码来源:Lista_d.c


示例20: terminate_list_arr

static void terminate_list_arr(linked_list_t **arr)
{
    for (int i = 0; i < NUM_TOTAL_CHARS; i++) {
        destroy_list(arr[i]);
    }
    free(arr);
}
开发者ID:alicesibold,项目名称:MorseBerry-Pi,代码行数:7,代码来源:morse.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ destroy_node函数代码示例发布时间:2022-05-30
下一篇:
C++ destroy_inodecache函数代码示例发布时间: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