<commit_before>/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * Simple double linked list implementation.
 *
 * Author: <NAME> <<EMAIL>>
 */
#ifndef __LIST_H__
#define __LIST_H__

#include <ckit/ckit.h>

typedef struct list {
    struct list *prev, *next;
} list_t;

/**
 * Initialize the list anchor (head). Must be called once on all list
 * objects acting as anchors.
 */
#define LIST_INIT(list)                             \
    { (list)->prev = list; (list)->next = list; }

/**
 * Add element to front of list.
 */
static inline void list_add_front(struct list *anchor, struct list *to_add)
{
    to_add->next = anchor->next;
    to_add->prev = anchor;
    anchor->next->prev = to_add;
    anchor->next = to_add;
}

/**
 * Add element to back of list.
 */
static inline void list_add_back(struct list *anchor, struct list *to_add)
{
    to_add->next = anchor;
    to_add->prev = anchor->prev;
    anchor->prev->next = to_add;
    anchor->prev = to_add;
}

/**
 * Delete an element from the list it belongs to.
 */
static inline void list_del(struct list *to_del)
{
    to_del->prev->next = to_del->next;
    to_del->next->prev = to_del->prev;
    to_del->next = to_del->prev = NULL;
}

/**
 * Check if list is empty (0 = empty , 1 otherwise).
 */
#define list_empty(list) ((list)->next == (list))<commit_msg>Added list_move function<commit_after>/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * Simple double linked list implementation.
 *
 * Author: <NAME> <<EMAIL>>
 */
#ifndef __LIST_H__
#define __LIST_H__

#include <ckit/ckit.h>

typedef struct list {
    struct list *prev, *next;
} list_t;

/**
 * Initialize the list anchor (head). Must be called once on all list
 * objects acting as anchors.
 */
#define LIST_INIT(list)                             \
    { (list)->prev = list; (list)->next = list; }

/**
 * Add element to front of list.
 */
static inline void list_add_front(struct list *anchor, struct list *to_add)
{
    to_add->next = anchor->next;
    to_add->prev = anchor;
    anchor->next->prev = to_add;
    anchor->next = to_add;
}

/**
 * Add element to back of list.
 */
static inline void list_add_back(struct list *anchor, struct list *to_add)
{
    to_add->next = anchor;
    to_add->prev = anchor->prev;
    anchor->prev->next = to_add;
    anchor->prev = to_add;
}

/**
 * Delete an element from the list it belongs to.
 */
static inline void list_del(struct list *to_del)
{
    to_del->prev->next = to_del->next;
    to_del->next->prev = to_del->prev;
    to_del->next = to_del->prev = NULL;
}

/**
 * Move element from one list to another.
 */
static inline void list_move(struct list *to_move, struct list *anchor)
{
    to_move->prev->next = to_move->next;
    to_move->next->prev = to_move->prev;
    list_add_front(anchor, to_move);
}

/**
 * Check if list is empty (0 = empty , 1 otherwise).
 */
#define list_empty(list) ((list)->next == (list))
{'fraction_non_alphanumeric': 0.15363790186125212, 'fraction_numerical': 0.0027072758037225042, 'mean_word_length': 2.9838274932614555, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 63, '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': '724503', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1011, 'n_words': 291}