コード例 #1
0
ファイル: list.c プロジェクト: FSchumacher/openlava
void
listObserverDetach(LIST_OBSERVER_T *observer, LIST_T *list)
{
    if (observer->list)
        listRemoveEntry(observer->list, (LIST_ENTRY_T *)observer);

    observer->list = NULL;
}
コード例 #2
0
ファイル: list.c プロジェクト: CraigNoble/openlava
/* listPop()
 *
 * Remove the element from the forw pointer of the
 * list.
 */
LIST_ENTRY_T *
listPop(LIST_T *list)
{
    LIST_ENTRY_T *ent;

    if (LIST_IS_EMPTY(list))
        return NULL;

    ent = list->forw;
    listRemoveEntry(list, ent);

    return ent;
}
コード例 #3
0
ファイル: list.c プロジェクト: CraigNoble/openlava
void
listDestroy(LIST_T *list, void (*destroy)(LIST_ENTRY_T *))
{
    LIST_ENTRY_T *entry;

    while (! LIST_IS_EMPTY(list)) {
        entry = list->forw;

        listRemoveEntry(list, entry);
        if (destroy)
            (*destroy)(entry);
        else
            free(entry);
    }

    free(list->name);
    free(list);
}
コード例 #4
0
ファイル: list.c プロジェクト: FSchumacher/openlava
void
listDestroy(LIST_T *list, void (*destroy)(LIST_ENTRY_T *))
{
    LIST_ENTRY_T *entry;

    while (! LIST_IS_EMPTY(list)) {
        entry = list->forw;

        listRemoveEntry(list, entry);
        if (destroy)
            (*destroy)(entry);
        else
            free(entry);
    }

    if (list->allowObservers) {

        listDestroy(list->observers,
                    (LIST_ENTRY_DESTROY_FUNC_T)&listObserverDestroy);
    }

    free(list->name);
    free(list);
}