Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
pycore_c_array.h40 linesDownload Raw Back to internal
1#ifndef Py_INTERNAL_C_ARRAY_H2#define Py_INTERNAL_C_ARRAY_H3 4#ifdef __cplusplus5extern "C" {6#endif7 8#ifndef Py_BUILD_CORE9#  error "this header requires Py_BUILD_CORE define"10#endif11 12 13/* Utility for a number of growing arrays */14 15typedef struct {16    void *array;              /* pointer to the array */17    int allocated_entries;    /* pointer to the capacity of the array */18    size_t item_size;         /* size of each element */19    int initial_num_entries;  /* initial allocation size */20} _Py_c_array_t;21 22 23int _Py_CArray_Init(_Py_c_array_t* array, int item_size, int initial_num_entries);24void _Py_CArray_Fini(_Py_c_array_t* array);25 26/* If idx is out of bounds:27 * If arr->array is NULL, allocate arr->initial_num_entries slots.28 * Otherwise, double its size.29 *30 * Return 0 if successful and -1 (with exception set) otherwise.31 */32int _Py_CArray_EnsureCapacity(_Py_c_array_t *c_array, int idx);33 34 35#ifdef __cplusplus36}37#endif38 39#endif /* !Py_INTERNAL_C_ARRAY_H */40 
codekingpro/portable-devtools · Team Ai