source:
trunk/essentials/dev-lang/python/Python/asdl.c
| Last change on this file was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 661 bytes | |
| Line | |
|---|---|
| 1 | #include "Python.h" |
| 2 | #include "asdl.h" |
| 3 | |
| 4 | asdl_seq * |
| 5 | asdl_seq_new(int size, PyArena *arena) |
| 6 | { |
| 7 | asdl_seq *seq = NULL; |
| 8 | size_t n = sizeof(asdl_seq) + |
| 9 | (size ? (sizeof(void *) * (size - 1)) : 0); |
| 10 | |
| 11 | seq = (asdl_seq *)PyArena_Malloc(arena, n); |
| 12 | if (!seq) { |
| 13 | PyErr_NoMemory(); |
| 14 | return NULL; |
| 15 | } |
| 16 | memset(seq, 0, n); |
| 17 | seq->size = size; |
| 18 | return seq; |
| 19 | } |
| 20 | |
| 21 | asdl_int_seq * |
| 22 | asdl_int_seq_new(int size, PyArena *arena) |
