Staging
v0.8.1
https://github.com/python/cpython
Revision 6cc7940e10372aa696ac62d9ab00bf0717a94ae6 authored by Barry Warsaw on 08 May 2008, 13:16:19 UTC, committed by Barry Warsaw on 08 May 2008, 13:16:19 UTC
1 parent c27b8b8
Raw File
Tip revision: 6cc7940e10372aa696ac62d9ab00bf0717a94ae6 authored by Barry Warsaw on 08 May 2008, 13:16:19 UTC
Bump to 2.6a3
Tip revision: 6cc7940
asdl.c
#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;
}

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

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