summaryrefslogtreecommitdiffstats
path: root/Python/asdl.c
blob: 225df6e7612c22b3522eb44a687fedd7d1e1d3db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "Python.h"
#include "asdl.h"

asdl_seq *
asdl_seq_new(int size, PyArena *arena)
{
	asdl_seq *seq = NULL;
	size_t n = sizeof(asdl_seq) +
			(size ? (sizeof(void *) * (size - 1)) : 0);

    seq = (asdl_seq *)PyArena_Malloc(arena, n);
	if (!seq) {
		PyErr_NoMemory();
		return NULL;
	}
	memset(seq, 0, n);
	seq->size = size;
	return seq;
}