5 asdl_seq_new(int size
, PyArena
*arena
)
8 size_t n
= (size
? (sizeof(void *) * (size
- 1)) : 0);
10 /* check size is sane */
11 if (size
< 0 || size
== INT_MIN
||
12 (size
&& ((size
- 1) > (PY_SIZE_MAX
/ sizeof(void *))))) {
17 /* check if size can be added safely */
18 if (n
> PY_SIZE_MAX
- sizeof(asdl_seq
)) {
23 n
+= sizeof(asdl_seq
);
25 seq
= (asdl_seq
*)PyArena_Malloc(arena
, n
);
36 asdl_int_seq_new(int size
, PyArena
*arena
)
38 asdl_int_seq
*seq
= NULL
;
39 size_t n
= (size
? (sizeof(void *) * (size
- 1)) : 0);
41 /* check size is sane */
42 if (size
< 0 || size
== INT_MIN
||
43 (size
&& ((size
- 1) > (PY_SIZE_MAX
/ sizeof(void *))))) {
48 /* check if size can be added safely */
49 if (n
> PY_SIZE_MAX
- sizeof(asdl_seq
)) {
54 n
+= sizeof(asdl_seq
);
56 seq
= (asdl_int_seq
*)PyArena_Malloc(arena
, n
);