Exemplo n.º 1
0
/*
*   Free all memory
*/ 
void
acsmFree (ACSM_STRUCT * acsm) 
{
    int i;
    ACSM_PATTERN * mlist, *ilist;
    for (i = 0; i < acsm->acsmMaxStates; i++)
    {
        mlist = acsm->acsmStateTable[i].MatchList;
        while (mlist)
        {
            ilist = mlist;
            mlist = mlist->next;
            AC_FREE (ilist);
        }
    }
    AC_FREE (acsm->acsmStateTable);
    mlist = acsm->acsmPatterns;
    while(mlist)
    {
        ilist = mlist;
        mlist = mlist->next;
        AC_FREE(ilist->patrn);
        AC_FREE(ilist->casepatrn);
        AC_FREE(ilist);
    }
    AC_FREE (acsm);
}
Exemplo n.º 2
0
/*
*   Free all memory
*/ 
void acsmFree (ACSM_STRUCT * acsm) 
{
	
	int i;
	ACSM_PATTERN * mlist, *ilist;
	for (i = 0; i <acsm->acsmNumStates; i++)

	{
		if (acsm->acsmStateTable[i].MatchList != NULL)

		{
			mlist = acsm->acsmStateTable[i].MatchList;
			while (mlist)
			{
				ilist = mlist;
				mlist = mlist->next;
				AC_FREE (ilist);
			}
		}
	}
	
	AC_FREE (acsm->acsmStateTable);
}
Exemplo n.º 3
0
/*
*   Free all memory
*/ 
void
acsmFree (ACSM_STRUCT * acsm) 
{
    int i;
    ACSM_PATTERN * mlist, *ilist;
    for (i = 0; i < acsm->acsmMaxStates; i++)
    {
        mlist = acsm->acsmStateTable[i].MatchList;
        while (mlist)
        {
            ilist = mlist;
            mlist = mlist->next;

            ilist->udata->ref_count--;
            if (ilist->udata->ref_count == 0)
            {
                if (acsm->userfree && ilist->udata->id)
                    acsm->userfree(ilist->udata->id);

                AC_FREE(ilist->udata);
            }

            if (ilist->rule_option_tree && acsm->optiontreefree)
            {
                acsm->optiontreefree(&(ilist->rule_option_tree));
            }

            if (ilist->neg_list && acsm->neg_list_free)
            {
                acsm->neg_list_free(&(ilist->neg_list));
            }

            AC_FREE (ilist);
        }
    }
    AC_FREE (acsm->acsmStateTable);
    mlist = acsm->acsmPatterns;
    while(mlist)
    {
        ilist = mlist;
        mlist = mlist->next;
        AC_FREE(ilist->patrn);
        AC_FREE(ilist->casepatrn);
        AC_FREE(ilist);
    }
    AC_FREE (acsm);
}
Exemplo n.º 4
0
/*
 *  Remove Head Item from queue
 */ 
static int queue_remove (QUEUE * s) 
{
	int state = 0;
	QNODE * q;
	if (s->head)
	{
		q = s->head;
		state = q->state;
		s->head = s->head->next;
		s->count--;
		if (!s->head)
		{
			s->tail = 0;
			s->count = 0;
		}
		AC_FREE (q);
	}
	return state;
}
Exemplo n.º 5
0
/*
*  Remove Head Item from queue
*/ 
static int queue_remove (QUEUE * s) 
{
	int state = 0;
	QNODE * q;
	/*Remove A QueueNode From the head of the Queue*/
	if (s->head)
	{
		q = s->head;
		state = q->state;
		s->head = s->head->next;
		s->count--;

		/*If Queue is Empty,After Remove A QueueNode*/
		if (!s->head)
		{
			s->tail = 0;
			s->count = 0;
		}
		/*Free the QueNode Memory*/
		AC_FREE (q);
	}
	return state;
}
Exemplo n.º 6
0
/******************************************************************************
 * FUNCTION: node_release
 * Release node
******************************************************************************/
void node_release(AC_NODE_t * thiz)
{
	AC_FREE(thiz->matched_patterns);
	AC_FREE(thiz->outgoing);
	AC_FREE(thiz);
}