示例#1
0
void
destroy_dpy (void *abstract_dpy)
{
    display_ctxs_surfaces_t *dpy_sur = (display_ctxs_surfaces_t *)abstract_dpy;
    link_list_clear (&(dpy_sur)->surfaces);
    link_list_clear (&(dpy_sur)->contexts);
    free (dpy_sur);
}
示例#2
0
void
egl_state_destroy (void *abstract_state)
{
    egl_state_t *state = abstract_state;

    if (state->vertex_attribs.attribs != state->vertex_attribs.embedded_attribs)
        free (state->vertex_attribs.attribs);

    link_list_clear (&state->shader_objects);

    if (state->vendor_string)
        free (state->vendor_string);
    if (state->renderer_string)
        free (state->renderer_string);
    if (state->version_string)
        free (state->version_string);
    if (state->shading_language_version_string)
        free (state->version_string);
    if (state->extensions_string)
        free (state->extensions_string);

    if (state->shader_objects_name_handler)
        name_handler_destroy (state->shader_objects_name_handler);
    if (state->texture_name_handler)
        name_handler_destroy (state->texture_name_handler);
    if (state->framebuffer_name_handler)
        name_handler_destroy (state->framebuffer_name_handler);
    if (state->renderbuffer_name_handler)
        name_handler_destroy (state->renderbuffer_name_handler);
    if (state->buffer_name_handler)
        name_handler_destroy (state->buffer_name_handler);

    free (state);
}
示例#3
0
void
delay_table_delete_obsolete(time_t cur_time)
{
    int          i, count = 0;
    hash_node   *hn1, *hn2;
    link_list   *msg_list, *l;
    p_link_node  ln, tail;

    tc_log_info(LOG_NOTICE, 0, "delay total:%u", table->total);

    for (i = 0; i < table->size; i++) {
        l  = table->lists[i];
        while (true) {

            ln = link_list_tail(l);
            if (ln == NULL) {
                break;
            }   

            hn1 = (hash_node *) ln->data;
            if ( (hn1->access_time + table->timeout) < cur_time) {
                count++;
                table->total--;
                tail = link_list_pop_tail(l);
                hn2  = (hash_node *) tail->data;
                if (hn2 != NULL) {   
                    if (hn2->data != NULL) {
                        msg_list = (link_list *) hn2->data;
                        msg_item_destr_cnt += link_list_clear(msg_list);
                        free(msg_list);     
                        hn2->data = NULL;
                        msg_ls_destr_cnt++;
                    }
                    free(hn2);
                }   
                tail->data = NULL;
                free(tail);
            } else {
                break;
            }   
        } 
    }

    tc_log_info(LOG_NOTICE, 0, "delay delete obsolete :%d", count);
}
示例#4
0
文件: hash.c 项目: jbli/tcpcopy
void hash_destroy(hash_table *table)
{
    uint32_t     index = 0;
    int          count = 0;
    link_list    *l;

    for(; index < table->size; index++){
        l = table->lists[index];
        if(l != NULL){
            count += link_list_clear(l);
            free(l);
        }
    }
    free(table->lists);
    log_info(LOG_NOTICE, "total visit hash_find_node:%llu,compared:%llu",
            table->total_visit, table->total_key_compared);
    log_info(LOG_NOTICE, "destroy items %d in table name:%s",
            count, table->name);
}
示例#5
0
/* destroy delay table */
void
delay_table_destroy()
{
    uint32_t     i;
    link_list   *msg_list, *list;
    hash_node   *hn;
    p_link_node  ln;

    if (table != NULL) {

        tc_log_info(LOG_NOTICE, 0, "destroy delay table,total:%u",
                table->total);

        for (i = 0; i < table->size; i++) {
            list = table->lists[i];
            ln   = link_list_first(list);
            while (ln) {
                hn = (hash_node *) ln->data;
                if (hn->data != NULL) {
                    msg_list = (link_list *) hn->data;
                    msg_item_destr_cnt += link_list_clear(msg_list);
                    free(msg_list);
                    msg_ls_destr_cnt++;
                }   
                hn->data = NULL;
                ln = link_list_get_next(list, ln);
            }
        }

        tc_log_info(LOG_NOTICE, 0, "destroy items:%llu,free:%llu,total:%llu",
                msg_item_destr_cnt, msg_item_free_cnt, msg_item_cnt);
        tc_log_info(LOG_NOTICE, 0, "create msg list:%llu,free:%llu,destr:%llu",
                msg_ls_cnt, msg_ls_free_cnt, msg_ls_destr_cnt);
        tc_log_info(LOG_NOTICE, 0, "delay actual sent:%llu", 
                msg_delay_sent_cnt);


        hash_destroy(table);
        free(table);
        table = NULL;
    }
}
示例#6
0
文件: tst-link.c 项目: jcseg/friso
int main( int argc, char **args ) {

    friso_link_t link;
    string keys[] = {
        "chenmanwen", "yangqinghua",
        "chenxin", "luojiangyan", "xiaoyanzi", "bibi",
        "zhangrenfang", "yangjian",
        "liuxiao", "pankai",
        "chenpei", "liheng", "zhangzhigang", "zhgangyishao", "yangjiangbo",
        "caizaili", "panpan", "xiaolude", "yintanwen"
    };
    int j, len = sizeof( keys ) / sizeof( string );

    link = new_link_list();

    //print the size of the link
    printf("size=%d\n", link->size );

    for ( j = 0; j < len; j++ ) {
        //link_add( link, keys[j] );
        link_list_add_last( link, keys[j] );
    }

    printf("size=%d\n", link->size );

    for ( j = 0; j < len / 2; j++ ) {
        //printf("idx=%d, remove %s\n", j, ( string ) link_remove( link, 0 ) );
        printf("idx=%d, remove %s\n", j, ( string ) link_list_remove_first( link ) );
    }

    printf("size=%d\n", link->size );

    //clear all the nodes
    link_list_clear( link );
    printf("size=%d, head->next->value=%s\n", link->size, ( string ) link->head->next->value );

    free_link_list( link );

    return 0;
}
void
command_gldrawarrays_destroy_arguments (command_gldrawarrays_t *command)
{
    link_list_clear (&command->arrays_to_free);
}
示例#8
0
文件: friso.c 项目: PinZhang/friso
/*
 * set the text of the current segmentation.
 *		that means we could re-use the segment.
 *	also we have to reset the idx and the length of the segmentation.
 		and the most important one - clear the poll link list.
 *		
 */
__EXTERN_API__ void friso_set_text( friso_task_t task, string text ) {
	task->text = text;
	task->idx = 0;										//reset the index
	task->length = strlen( text );
	task->poll = link_list_clear( task->poll );			//clear the word poll
}