| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #ifndef Py_INTERNAL_C_ARRAY_H | ||
| #define Py_INTERNAL_C_ARRAY_H | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #ifndef Py_BUILD_CORE | ||
| # error "this header requires Py_BUILD_CORE define" | ||
| #endif | ||
|
|
||
|
|
||
| /* Utility for a number of growing arrays */ | ||
|
|
||
| typedef struct { | ||
| void *array; /* pointer to the array */ | ||
| int allocated_entries; /* pointer to the capacity of the array */ | ||
| size_t item_size; /* size of each element */ | ||
| int initial_num_entries; /* initial allocation size */ | ||
| } _Py_c_array_t; | ||
|
|
||
|
|
||
| int _Py_CArray_Init(_Py_c_array_t* array, int item_size, int initial_num_entries); | ||
| void _Py_CArray_Fini(_Py_c_array_t* array); | ||
|
|
||
| /* If idx is out of bounds: | ||
| * If arr->array is NULL, allocate arr->initial_num_entries slots. | ||
| * Otherwise, double its size. | ||
| * | ||
| * Return 0 if successful and -1 (with exception set) otherwise. | ||
| */ | ||
| int _Py_CArray_EnsureCapacity(_Py_c_array_t *c_array, int idx); | ||
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* !Py_INTERNAL_C_ARRAY_H */ |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityHaving to manually initialize a struct, just to pass it to a function seems clunky. The previous API was probably better.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis is just to make the transition now. If we were defining basic block from scratch we would have put this struct field in it. But I think now that's a transformation for another PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.