diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 12:29:43 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 12:29:43 (GMT) |
commit | 0cc56e5c59bbc9d839d1468f8b51ea9391e8852a (patch) | |
tree | b01b94983a324fdc0e660fdd194a9f67060a6e6a /Python/asdl.c | |
parent | 0f1955daeea82b6d8765d2b7642a9f082faddc74 (diff) | |
download | cpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.zip cpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.tar.gz cpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.tar.bz2 |
Introduce asdl_int_seq, to hold cmpop_ty.
Diffstat (limited to 'Python/asdl.c')
-rw-r--r-- | Python/asdl.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Python/asdl.c b/Python/asdl.c index 225df6e..416b293 100644 --- a/Python/asdl.c +++ b/Python/asdl.c @@ -8,7 +8,24 @@ asdl_seq_new(int size, PyArena *arena) size_t n = sizeof(asdl_seq) + (size ? (sizeof(void *) * (size - 1)) : 0); - seq = (asdl_seq *)PyArena_Malloc(arena, n); + 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_seq *seq = NULL; + size_t n = sizeof(asdl_seq) + + (size ? (sizeof(int) * (size - 1)) : 0); + + seq = (asdl_seq *)PyArena_Malloc(arena, n); if (!seq) { PyErr_NoMemory(); return NULL; |