<commit_before>/* GLIB - Library of useful routines for C programming
 * Copyright (C) 1995-1997  <NAME>, <NAME> and <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GLib Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
 */

/*
 * MT safe
 */

#include "config.h"

#include "gslist.h"
#include "gtestutils.h"

/**
 * SECTION: linked_lists_single
 * @title: Singly-Linked Lists
 * @short_description: linked lists containing integer values or
 *                     pointers to data, limited to iterating over the
 *                     list in one direction
 *
 * The #GSList structure and its associated functions provide a
 * standard singly-linked list data structure.
 *
 * Each element in the list contains a piece of data, together with a
 * pointer which links to the next element in the list. Using this
 * pointer it is possible to move through the list in one direction
 * only (unlike the <link
 * linkend="glib-Doubly-Linked-lists">Doubly-Linked Lists</link> which
 * allow movement in both directions).
 *
 * The data contained in each element can be either integer values, by
 * using one of the <link linkend="glib-Type-Conversion-Macros">Type
 * Conversion Macros</link>, or simply pointers to any type of data.
 *
 * List elements are allocated from the <link
 * linkend="glib-Memory-Slices">slice allocator</link>, which is more
 * efficient than allocating elements individually.
 *
 * Note that most of the #GSList functions expect to be passed a
 * pointer to the first element in the list. The functions which insert
 * elements return the new start of the list, which may have changed.
 *
 * There is no function to create a #GSList. %NULL is considered to be
 * the empty list so you simply set a #GSList* to %NULL.
 *
 * To add elements, use g_slist_append(), g_slist_prepend(),
 * g_slist_insert() and g_slist_insert_sorted().
 *
 * To remove elements, use g_slist_remove().
 *
 * To find elements in the list use g_slist_last(), g_slist_next(),
 * g_slist_nth(), g_slist_nth_data(), g_slist_find() and
 * g_slist_find_custom().
 *
 * To find the index of an element use g_slist_position() and
 * g_slist_index().
 *
 * To call a function for each element in the list use
 * g_slist_foreach().
 *
 * To free the entire list, use g_slist_free().
 **/

/**
 * GSList:
 * @data: holds the element's data, which can be a pointer to any kind
 *        of data, or any integer value using the <link
 *        linkend="glib-Type-Conversion-Macros">Type Conversion
 *        Macros</link>.
 * @next: contains the link to the next element in the list.
 *
 * The #GSList struct is used for each element in the singly-linked
 * list.
 **/

/**
 * g_slist_next:
 * @slist: an element in a #GSList.
 * @Returns: the next element, or %NULL if there are no more elements.
 *
 * A convenience macro to get the next element in a #GSList.
 **/


/**
 * g_slist_push_allocator:
 * @dummy: the #GAllocator to use when allocating #GSList elements.
 *
 * Sets the allocator to use to allocate #GSList elements. Use
 * g_slist_pop_allocator() to restore the previous allocator.
 *
 * Note that this function is not available if GLib has been compiled
 * with <option>--disable-mem-pools</option>
 *
 * Deprecated: 2.10: It does nothing, since #GSList has been converted
 *                   to the <link linkend="glib-Memory-Slices">slice
 *                   allocator</link>
 **/
void g_slist_push_allocator (gpointer dummy) { /* present for binary compat only */ }

/**
 * g_slist_pop_allocator:
 *
 * Restores the previous #GAllocator, used when allocating #GSList
 * elements.
 *
 * Note that this function is not available if GLib has been compiled
 * with <option>--disable-mem-pools</option>
 *
 * Deprecated: 2.10: It does nothing, since #GSList has been converted
 *                   to the <link linkend="glib-Memory-Slices">slice
 *                   allocator</link>
 **/
void g_slist_pop_allocator  (void)           { /* present for binary compat only */ }

#define _g_slist_alloc0()       g_slice_new0 (GSList)
#define _g_slist_alloc()        g_slice_new (GSList)
#define _g_slist_free1(slist)   g_slice_free (GSList, slist)

/**
 * g_slist_alloc:
 * @Returns: a pointer to the newly-allocated #GSList element.
 *
 * Allocates space for one #GSList element. It is called by the
 * g_slist_append(), g_slist_prepend(), g_slist_insert() and
 * g_slist_insert_sorted() functions and so is rarely used on its own.
 **/
GSList*
g_slist_alloc (void)
{
  return _g_slist_alloc0 ();
}

/**
 * g_slist_free:
 * @list: a #GSList
 *
 * Frees all of the memory used by a #GSList.
 * The freed elements are returned to the slice allocator.
 */<commit_msg>Added note in g_slist_free about using *free_full to mirror GList docs<commit_after>/* GLIB - Library of useful routines for C programming
 * Copyright (C) 1995-1997  <NAME>, <NAME> and <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GLib Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
 */

/*
 * MT safe
 */

#include "config.h"

#include "gslist.h"
#include "gtestutils.h"

/**
 * SECTION: linked_lists_single
 * @title: Singly-Linked Lists
 * @short_description: linked lists containing integer values or
 *                     pointers to data, limited to iterating over the
 *                     list in one direction
 *
 * The #GSList structure and its associated functions provide a
 * standard singly-linked list data structure.
 *
 * Each element in the list contains a piece of data, together with a
 * pointer which links to the next element in the list. Using this
 * pointer it is possible to move through the list in one direction
 * only (unlike the <link
 * linkend="glib-Doubly-Linked-lists">Doubly-Linked Lists</link> which
 * allow movement in both directions).
 *
 * The data contained in each element can be either integer values, by
 * using one of the <link linkend="glib-Type-Conversion-Macros">Type
 * Conversion Macros</link>, or simply pointers to any type of data.
 *
 * List elements are allocated from the <link
 * linkend="glib-Memory-Slices">slice allocator</link>, which is more
 * efficient than allocating elements individually.
 *
 * Note that most of the #GSList functions expect to be passed a
 * pointer to the first element in the list. The functions which insert
 * elements return the new start of the list, which may have changed.
 *
 * There is no function to create a #GSList. %NULL is considered to be
 * the empty list so you simply set a #GSList* to %NULL.
 *
 * To add elements, use g_slist_append(), g_slist_prepend(),
 * g_slist_insert() and g_slist_insert_sorted().
 *
 * To remove elements, use g_slist_remove().
 *
 * To find elements in the list use g_slist_last(), g_slist_next(),
 * g_slist_nth(), g_slist_nth_data(), g_slist_find() and
 * g_slist_find_custom().
 *
 * To find the index of an element use g_slist_position() and
 * g_slist_index().
 *
 * To call a function for each element in the list use
 * g_slist_foreach().
 *
 * To free the entire list, use g_slist_free().
 **/

/**
 * GSList:
 * @data: holds the element's data, which can be a pointer to any kind
 *        of data, or any integer value using the <link
 *        linkend="glib-Type-Conversion-Macros">Type Conversion
 *        Macros</link>.
 * @next: contains the link to the next element in the list.
 *
 * The #GSList struct is used for each element in the singly-linked
 * list.
 **/

/**
 * g_slist_next:
 * @slist: an element in a #GSList.
 * @Returns: the next element, or %NULL if there are no more elements.
 *
 * A convenience macro to get the next element in a #GSList.
 **/


/**
 * g_slist_push_allocator:
 * @dummy: the #GAllocator to use when allocating #GSList elements.
 *
 * Sets the allocator to use to allocate #GSList elements. Use
 * g_slist_pop_allocator() to restore the previous allocator.
 *
 * Note that this function is not available if GLib has been compiled
 * with <option>--disable-mem-pools</option>
 *
 * Deprecated: 2.10: It does nothing, since #GSList has been converted
 *                   to the <link linkend="glib-Memory-Slices">slice
 *                   allocator</link>
 **/
void g_slist_push_allocator (gpointer dummy) { /* present for binary compat only */ }

/**
 * g_slist_pop_allocator:
 *
 * Restores the previous #GAllocator, used when allocating #GSList
 * elements.
 *
 * Note that this function is not available if GLib has been compiled
 * with <option>--disable-mem-pools</option>
 *
 * Deprecated: 2.10: It does nothing, since #GSList has been converted
 *                   to the <link linkend="glib-Memory-Slices">slice
 *                   allocator</link>
 **/
void g_slist_pop_allocator  (void)           { /* present for binary compat only */ }

#define _g_slist_alloc0()       g_slice_new0 (GSList)
#define _g_slist_alloc()        g_slice_new (GSList)
#define _g_slist_free1(slist)   g_slice_free (GSList, slist)

/**
 * g_slist_alloc:
 * @Returns: a pointer to the newly-allocated #GSList element.
 *
 * Allocates space for one #GSList element. It is called by the
 * g_slist_append(), g_slist_prepend(), g_slist_insert() and
 * g_slist_insert_sorted() functions and so is rarely used on its own.
 **/
GSList*
g_slist_alloc (void)
{
  return _g_slist_alloc0 ();
}

/**
 * g_slist_free:
 * @list: a #GSList
 *
 * Frees all of the memory used by a #GSList.
 * The freed elements are returned to the slice allocator.
 *
 * <note><para>
 * If list elements contain dynamically-allocated memory,
 * you should either use g_slist_free_full() or free them manually
 * first.
 * </para></note>
 */
{'fraction_non_alphanumeric': 0.09104543449492722, 'fraction_numerical': 0.007234230260255845, 'mean_word_length': 3.416049863654071, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '599128', 'n_tokens_mistral': 3481, 'n_tokens_neox': 3386, 'n_words': 1412}