<commit_before>/*
 * Copyright (C) 2010 Red Hat, Inc.
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This file is part of libqb.
 *
 * libqb 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.
 *
 * libqb 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 libqb.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef QB_ARRAY_H_DEFINED
#define QB_ARRAY_H_DEFINED

#include <stdint.h>
#ifndef S_SPLINT_S
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <qb/qbdefs.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
 * @file qbarray.h
 * This is a dynamic array (it can grow, but without moving memory).
 *
 * @code
 * arr = qb_array_create_2(64, sizeof(struct my_struct), 256);
 * ...
 * res = qb_array_index(arr, idx, (void**)&my_ptr);
 * if (res < 0) {
 *	return res;
 * }
 * // use my_ptr, now even if there is a grow, this pointer will be valid.
 * @endcode
 *
 * Currently, this dynamic array abstract data type can accommodate only
 * 2^(@c * QB_ARRAY_MAX_INDEX_BITS) elements, and with standard zero-based
 * indexing, this gives a valid index range [0, @c QB_ARRAY_MAX_ELEMENTS),
 * where the notation denotes the beginning of the interval is included and
 * the end is excluded.  In other words, client space shall avoid a pitfall
 * of relying solely on the type of @c max_elements parameter to
 * @ref qb_array_create and/or of @c idx parameter to @ref qb_array_index
 * (these types conflict, anyway).
 */

#define QB_ARRAY_MAX_INDEX_BITS 16
#define QB_ARRAY_MAX_ELEMENTS (1 << QB_ARRAY_MAX_INDEX_BITS)

struct qb_array;

/**
 * This is an opaque data type representing an instance of an array.
 */
typedef struct qb_array qb_array_t;
<commit_msg>doc: qbarray.h: remove stray asterisk and parentheses<commit_after>/*
 * Copyright (C) 2010 Red Hat, Inc.
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This file is part of libqb.
 *
 * libqb 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.
 *
 * libqb 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 libqb.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef QB_ARRAY_H_DEFINED
#define QB_ARRAY_H_DEFINED

#include <stdint.h>
#ifndef S_SPLINT_S
#include <unistd.h>
#endif /* S_SPLINT_S */
#include <qb/qbdefs.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
 * @file qbarray.h
 * This is a dynamic array (it can grow, but without moving memory).
 *
 * @code
 * arr = qb_array_create_2(64, sizeof(struct my_struct), 256);
 * ...
 * res = qb_array_index(arr, idx, (void**)&my_ptr);
 * if (res < 0) {
 *	return res;
 * }
 * // use my_ptr, now even if there is a grow, this pointer will be valid.
 * @endcode
 *
 * Currently, this dynamic array abstract data type can accommodate only
 * 2^@c QB_ARRAY_MAX_INDEX_BITS elements, and with standard zero-based
 * indexing, this gives a valid index range [0, @c QB_ARRAY_MAX_ELEMENTS),
 * where the notation denotes the beginning of the interval is included and
 * the end is excluded.  In other words, client space shall avoid a pitfall
 * of relying solely on the type of @c max_elements parameter to
 * @ref qb_array_create and/or of @c idx parameter to @ref qb_array_index
 * (these types conflict, anyway).
 */

#define QB_ARRAY_MAX_INDEX_BITS 16
#define QB_ARRAY_MAX_ELEMENTS (1 << QB_ARRAY_MAX_INDEX_BITS)

struct qb_array;

/**
 * This is an opaque data type representing an instance of an array.
 */
typedef struct qb_array qb_array_t;

{'fraction_non_alphanumeric': 0.09545663148233134, 'fraction_numerical': 0.008260670032124828, 'mean_word_length': 3.90326209223847, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1263951', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1377, 'n_words': 570}