<commit_before>//
// ctable linked list routines
//
//
// $Id$
//


//
// ctable_ListInit - initialize a list
//
inline void
ctable_ListInit (ctable_BaseRow **listPtr)
{
    *listPtr = NULL;
}

//
// ctable_ListEmpty - return 1 if the list is empty, else 0.
//
inline int
ctable_ListEmpty (ctable_BaseRow *list)
{
    return (list == NULL);
}

//
// ctable_ListRemove - remove a row from a list
//
inline void
ctable_ListRemove (ctable_BaseRow *row, int i)
{
    // if there's an object following me, make his prev be my prev
    if (row->_ll_nodes[i].next != NULL) {
        row->_ll_nodes[i].next->_ll_nodes[i].prev = row->_ll_nodes[i].prev;
    }

    // make my prev's next (or header) point to my next
    *row->_ll_nodes[i].prev = row->_ll_nodes[i].next;

    // i'm removed
    row->_ll_nodes[i].prev = NULL;
}

//
// ctable_ListRemoveMightBeTheLastOne - remove a row from a list
//
inline int
ctable_ListRemoveMightBeTheLastOne (ctable_BaseRow *row, int i)
{
    int mightBeTheLastOne;

    // if there's an object following me, make his prev be my prev
    if (row->_ll_nodes[i].next == NULL) {
        mightBeTheLastOne = 1;
    } else {
        // set the next guy's prev ptr to be my prev ptr
        row->_ll_nodes[i].next->_ll_nodes[i].prev = row->_ll_nodes[i].prev;
	mightBeTheLastOne = 0;
    }

    // make my prev's next (or header) point to my next
    *row->_ll_nodes[i].prev = row->_ll_nodes[i].next;

    // i'm removed
    row->_ll_nodes[i].prev = NULL;

    return mightBeTheLastOne;
}


inline void
ctable_ListInsertHead (ctable_BaseRow **listPtr, ctable_BaseRow *row, int i)
{
    // make the row's prev point to the address of the head pointer. Do this
    // first so it'll be in place before the readers can see it.
    row->_ll_nodes[i].prev = listPtr;
    row->_ll_nodes[i].head = listPtr;

    // make the new row's next point to what the head currently points
    // to, possibly NULL
    if ((row->_ll_nodes[i].next = *listPtr) != NULL) {

        // it wasn't null, make the node pointed to by head's prev<commit_msg>Make code flow fit comments better<commit_after>//
// ctable linked list routines
//
//
// $Id$
//


//
// ctable_ListInit - initialize a list
//
inline void
ctable_ListInit (ctable_BaseRow **listPtr)
{
    *listPtr = NULL;
}

//
// ctable_ListEmpty - return 1 if the list is empty, else 0.
//
inline int
ctable_ListEmpty (ctable_BaseRow *list)
{
    return (list == NULL);
}

//
// ctable_ListRemove - remove a row from a list
//
inline void
ctable_ListRemove (ctable_BaseRow *row, int i)
{
    // if there's an object following me, make his prev be my prev
    if (row->_ll_nodes[i].next != NULL) {
        row->_ll_nodes[i].next->_ll_nodes[i].prev = row->_ll_nodes[i].prev;
    }

    // make my prev's next (or header) point to my next
    *row->_ll_nodes[i].prev = row->_ll_nodes[i].next;

    // i'm removed
    row->_ll_nodes[i].prev = NULL;
}

//
// ctable_ListRemoveMightBeTheLastOne - remove a row from a list
//
inline int
ctable_ListRemoveMightBeTheLastOne (ctable_BaseRow *row, int i)
{
    int mightBeTheLastOne;

    // if there's an object following me, make his prev be my prev
    if (row->_ll_nodes[i].next != NULL) {
        // set the next guy's prev ptr to be my prev ptr
        row->_ll_nodes[i].next->_ll_nodes[i].prev = row->_ll_nodes[i].prev;
	mightBeTheLastOne = 0;
    } else {
	// else note that there was nothing following me
        mightBeTheLastOne = 1;
    }

    // make my prev's next (or header) point to my next
    *row->_ll_nodes[i].prev = row->_ll_nodes[i].next;

    // i'm removed
    row->_ll_nodes[i].prev = NULL;

    return mightBeTheLastOne;
}


inline void
ctable_ListInsertHead (ctable_BaseRow **listPtr, ctable_BaseRow *row, int i)
{
    // make the row's prev point to the address of the head pointer. Do this
    // first so it'll be in place before the readers can see it.
    row->_ll_nodes[i].prev = listPtr;
    row->_ll_nodes[i].head = listPtr;

    // make the new row's next point to what the head currently points
    // to, possibly NULL
    if ((row->_ll_nodes[i].next = *listPtr) != NULL) {

        // it wasn't null, make the node pointed to by head's prev
{'fraction_non_alphanumeric': 0.12694610778443113, 'fraction_numerical': 0.0019161676646706587, 'mean_word_length': 2.782608695652174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1268748', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1416, 'n_words': 448}