diff options
| author | orivej <[email protected]> | 2022-02-10 16:45:01 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:01 +0300 | 
| commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
| tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/python3/src/Python/asdl.c | |
| parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/asdl.c')
| -rw-r--r-- | contrib/tools/python3/src/Python/asdl.c | 128 | 
1 files changed, 64 insertions, 64 deletions
| diff --git a/contrib/tools/python3/src/Python/asdl.c b/contrib/tools/python3/src/Python/asdl.c index c21ca28da3a..c2110781181 100644 --- a/contrib/tools/python3/src/Python/asdl.c +++ b/contrib/tools/python3/src/Python/asdl.c @@ -1,64 +1,64 @@ -#include "Python.h"  -#include "asdl.h"  -  -asdl_seq *  -_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena)  -{  -    asdl_seq *seq = NULL;  -    size_t n;  -  -    /* check size is sane */  -    if (size < 0 ||  -        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {  -        PyErr_NoMemory();  -        return NULL;  -    }  -    n = (size ? (sizeof(void *) * (size - 1)) : 0);  -  -    /* check if size can be added safely */  -    if (n > SIZE_MAX - sizeof(asdl_seq)) {  -        PyErr_NoMemory();  -        return NULL;  -    }  -    n += sizeof(asdl_seq);  -  -    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 *  -_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena)  -{  -    asdl_int_seq *seq = NULL;  -    size_t n;  -  -    /* check size is sane */  -    if (size < 0 ||  -        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) {  -            PyErr_NoMemory();  -            return NULL;  -    }  -    n = (size ? (sizeof(void *) * (size - 1)) : 0);  -  -    /* check if size can be added safely */  -    if (n > SIZE_MAX - sizeof(asdl_seq)) {  -        PyErr_NoMemory();  -        return NULL;  -    }  -    n += sizeof(asdl_seq);  -  -    seq = (asdl_int_seq *)PyArena_Malloc(arena, n);  -    if (!seq) {  -        PyErr_NoMemory();  -        return NULL;  -    }  -    memset(seq, 0, n);  -    seq->size = size;  -    return seq;  -}  +#include "Python.h" +#include "asdl.h" + +asdl_seq * +_Py_asdl_seq_new(Py_ssize_t size, PyArena *arena) +{ +    asdl_seq *seq = NULL; +    size_t n; + +    /* check size is sane */ +    if (size < 0 || +        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { +        PyErr_NoMemory(); +        return NULL; +    } +    n = (size ? (sizeof(void *) * (size - 1)) : 0); + +    /* check if size can be added safely */ +    if (n > SIZE_MAX - sizeof(asdl_seq)) { +        PyErr_NoMemory(); +        return NULL; +    } +    n += sizeof(asdl_seq); + +    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 * +_Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena) +{ +    asdl_int_seq *seq = NULL; +    size_t n; + +    /* check size is sane */ +    if (size < 0 || +        (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { +            PyErr_NoMemory(); +            return NULL; +    } +    n = (size ? (sizeof(void *) * (size - 1)) : 0); + +    /* check if size can be added safely */ +    if (n > SIZE_MAX - sizeof(asdl_seq)) { +        PyErr_NoMemory(); +        return NULL; +    } +    n += sizeof(asdl_seq); + +    seq = (asdl_int_seq *)PyArena_Malloc(arena, n); +    if (!seq) { +        PyErr_NoMemory(); +        return NULL; +    } +    memset(seq, 0, n); +    seq->size = size; +    return seq; +} | 
