<commit_before>/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
 *
 * kit.h : OOM-safe utility library
 *
 * Copyright (C) 2007 <NAME>, <<EMAIL>>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 **************************************************************************/

#ifndef KIT_H
#define KIT_H

/**
 * SECTION:kit
 * @title: Macros
 * @short_description: Macros
 *
 * Various low-level macros.
 **/

#ifdef __cplusplus
#  define KIT_BEGIN_DECLS extern "C" {
#  define KIT_END_DECLS }
#else
/**
 * KIT_BEGIN_DECLS:
 *
 * C++ include header guard.
 */
#  define KIT_BEGIN_DECLS
/**
 * KIT_END_DECLS:
 *
 * C++ include header guard.
 */
#  define KIT_END_DECLS
#endif

/**
 * kit_bool_t:
 *
 * A boolean, valid values are #TRUE and #FALSE.
 */
typedef int kit_bool_t;

#ifndef TRUE
#  define TRUE 1
#endif
#ifndef FALSE
#  define FALSE 0
#endif

void kit_print_backtrace (void);

/**
 * kit_assert:
 * @expr: expression
 *
 * Debugging macro to terminate the application if the assertion
 * fails. If the assertion fails (i.e. the expression is not true), an
 * error message is logged and the application is terminated.
 */
#define kit_assert(expr)                                                                        \
do {                                                                                            \
        if (expr) {                                                                             \
                ;                                                                               \
        } else {                                                                                \
                kit_warning ("%s:%d:%s(): %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
                kit_print_backtrace ();                                                         \
                exit (1);                                                                       \
        }                                                                                       \
} while (0)

/**
 * kit_return_if_fail:
 * @expr: expression
 *
 * Returns from the current function if the expression is not true. If
 * the expression evaluates to #FALSE, an error message is logged and
 * the function returns. This can only be used in functions which do
 * not return a value.
 */
#define kit_return_if_fail(expr)                                                                \
do {                                                                                            \
        if (expr) {                                                                             \
                ;                                                                               \
        } else {                                                                                \
                kit_warning ("%s:%d:%s(): %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
                kit_print_backtrace ();                                                         \
                return;                                                                         \
        }                                                                                       \
} while (0)

/**
 * kit_return_val_if_fail:
 * @expr: expression
 * @val: the value to return if the expression evaluates does not
 * evaluate to #TRUE
 *
 * Returns from the current function, returning the value @val, if the
 * expression is not true. If the expression evaluates to #FALSE, an
 * error message is logged and val is returned.
 */
#define kit_return_val_if_fail(expr,val)                                                        \<commit_msg>add bogus Returns: to make gtk-doc happy<commit_after>/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/***************************************************************************
 *
 * kit.h : OOM-safe utility library
 *
 * Copyright (C) 2007 <NAME>, <<EMAIL>>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 **************************************************************************/

#ifndef KIT_H
#define KIT_H

/**
 * SECTION:kit
 * @title: Macros
 * @short_description: Macros
 *
 * Various low-level macros.
 **/

#ifdef __cplusplus
#  define KIT_BEGIN_DECLS extern "C" {
#  define KIT_END_DECLS }
#else
/**
 * KIT_BEGIN_DECLS:
 *
 * C++ include header guard.
 */
#  define KIT_BEGIN_DECLS
/**
 * KIT_END_DECLS:
 *
 * C++ include header guard.
 */
#  define KIT_END_DECLS
#endif

/**
 * kit_bool_t:
 *
 * A boolean, valid values are #TRUE and #FALSE.
 */
typedef int kit_bool_t;

#ifndef TRUE
#  define TRUE 1
#endif
#ifndef FALSE
#  define FALSE 0
#endif

void kit_print_backtrace (void);

/**
 * kit_assert:
 * @expr: expression
 *
 * Debugging macro to terminate the application if the assertion
 * fails. If the assertion fails (i.e. the expression is not true), an
 * error message is logged and the application is terminated.
 */
#define kit_assert(expr)                                                                        \
do {                                                                                            \
        if (expr) {                                                                             \
                ;                                                                               \
        } else {                                                                                \
                kit_warning ("%s:%d:%s(): %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
                kit_print_backtrace ();                                                         \
                exit (1);                                                                       \
        }                                                                                       \
} while (0)

/**
 * kit_return_if_fail:
 * @expr: expression
 *
 * Returns from the current function if the expression is not true. If
 * the expression evaluates to #FALSE, an error message is logged and
 * the function returns. This can only be used in functions which do
 * not return a value.
 *
 * Returns: nothing
 */
#define kit_return_if_fail(expr)                                                                \
do {                                                                                            \
        if (expr) {                                                                             \
                ;                                                                               \
        } else {                                                                                \
                kit_warning ("%s:%d:%s(): %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
                kit_print_backtrace ();                                                         \
                return;                                                                         \
        }                                                                                       \
} while (0)

/**
 * kit_return_val_if_fail:
 * @expr: expression
 * @val: the value to return if the expression evaluates does not
 * evaluate to #TRUE
 *
 * Returns from the current function, returning the value @val, if the
 * expression is not true. If the expression evaluates to #FALSE, an
 * error message is logged and val is returned.
 *
 * Returns: nothing
 */
#define kit_return_val_if_fail(expr,val)                                                        \
{'fraction_non_alphanumeric': 0.10233039875712066, 'fraction_numerical': 0.0022786121180735372, 'mean_word_length': 1.2752120640904807, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 112, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1721282', 'n_tokens_mistral': 2116, 'n_tokens_neox': 2008, 'n_words': 814}