当前位置: 首页>>代码示例>>C++>>正文


C++ destroy_list函数代码示例

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


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


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