<commit_before>/*
 * This file is part of linux-driver-management.
 *
 * Copyright © 2016-2017 <NAME>
 *
 * linux-driver-management 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.1
 * of the License, or (at your option) any later version.
 */

#pragma once

/**
 * Shut up the compiler
 */
#define __ldm_unused__ __attribute__((unused))

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */<commit_msg>util: Incorporate autofree/ARRAY_SIZE and friends<commit_after>/*
 * This file is part of linux-driver-management.
 *
 * Copyright © 2016-2017 <NAME>
 *
 * linux-driver-management 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.1
 * of the License, or (at your option) any later version.
 */

#pragma once

/**
 * Shut up the compiler
 */
#define __ldm_unused__ __attribute__((unused))

/**
 * Taken from libnica and about fourteen of my previous projects..
 */

#define DEF_AUTOFREE(N, C)                                                                         \
        static inline void _autofree_func_##N(void *p)                                             \
        {                                                                                          \
                if (p && *(N **)p) {                                                               \
                        C(*(N **)p);                                                               \
                        (*(void **)p) = NULL;                                                      \
                }                                                                                  \
        }

/**
 * Make use of __attribute__((cleanup(x))) functionality with a previously
 * declared autofree handler, by way of DEF_AUTOFREE
 */
#define autofree(N) __attribute__((cleanup(_autofree_func_##N))) N

/**
 * Determine size of static arrays
 */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 expandtab:
 * :indentSize=8:tabSize=8:noTabs=true:
 */
{'fraction_non_alphanumeric': 0.10500190912562046, 'fraction_numerical': 0.012600229095074456, 'mean_word_length': 1.6331658291457287, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4252053', 'n_tokens_mistral': 715, 'n_tokens_neox': 688, 'n_words': 217}