Logo Search packages:      
Sourcecode: jabberd2 version File versions  Download package

void mm_free ( mm_t  mm  ) 

free a mm instance

Definition at line 293 of file mm.c.

References mm_st::in_router, mm_st::in_sess, mm_st::modules, mm_st::nin_router, mm_st::nin_sess, mm_st::nout_router, mm_st::nout_sess, mm_st::npkt_router, mm_st::npkt_sm, mm_st::npkt_user, mm_st::nsess_end, mm_st::nsess_start, mm_st::nuser_create, mm_st::nuser_delete, mm_st::nuser_load, mm_st::out_router, mm_st::out_sess, mm_st::pkt_router, mm_st::pkt_sm, mm_st::pkt_user, mm_st::sess_end, mm_st::sess_start, mm_st::user_create, mm_st::user_delete, and mm_st::user_load.

                      {
    int i, j, *nlist = NULL;
    mod_instance_t **list = NULL, mi;

    /* close down modules */
    xhash_walk(mm->modules, _mm_reaper, NULL);

    /* free instances */
    for(i = 0; i < 12; i++) {
        switch(i) {
            case 0:
                list = &mm->sess_start;
                nlist = &mm->nsess_start;
                break;
            case 1:
                list = &mm->sess_end;
                nlist = &mm->nsess_end;
                break;
            case 2:
                list = &mm->in_sess;
                nlist = &mm->nin_sess;
                break;
            case 3:
                list = &mm->in_router;
                nlist = &mm->nin_router;
                break;
            case 4:
                list = &mm->out_sess;
                nlist = &mm->nout_sess;
                break;
            case 5:
                list = &mm->out_router;
                nlist = &mm->nout_router;
                break;
            case 6:
                list = &mm->pkt_sm;
                nlist = &mm->npkt_sm;
                break;
            case 7:
                list = &mm->pkt_user;
                nlist = &mm->npkt_user;
                break;
            case 8:
                list = &mm->pkt_router;
                nlist = &mm->npkt_router;
                break;
            case 9:
                list = &mm->user_load;
                nlist = &mm->nuser_load;
                break;
            case 10:
                list = &mm->user_create;
                nlist = &mm->nuser_create;
                break;
            case 11:
                list = &mm->user_delete;
                nlist = &mm->nuser_delete;
                break;
        }

        for(j = 0; j < *nlist; j++) {
            mi = (*list)[j];
            if(mi->arg != NULL)
                free(mi->arg);
            free(mi);
        }
    }

    /* free lists */
    free(mm->sess_start);
    free(mm->sess_end);
    free(mm->in_sess);
    free(mm->in_router);
    free(mm->out_sess);
    free(mm->out_router);
    free(mm->pkt_sm);
    free(mm->pkt_user);
    free(mm->pkt_router);
    free(mm->user_load);
    free(mm->user_create);
    free(mm->user_delete);

    xhash_free(mm->modules);

    free(mm);
}


Generated by  Doxygen 1.6.0   Back to index