| 87 | |
| 88 | |
| 89 | NPY_NO_EXPORT PyArrayIdentityHash * |
| 90 | PyArrayIdentityHash_New(int key_len) |
| 91 | { |
| 92 | PyArrayIdentityHash *res = PyMem_Malloc(sizeof(PyArrayIdentityHash)); |
| 93 | if (res == NULL) { |
| 94 | PyErr_NoMemory(); |
| 95 | return NULL; |
| 96 | } |
| 97 | |
| 98 | assert(key_len > 0); |
| 99 | res->key_len = key_len; |
| 100 | res->size = 4; /* Start with a size of 4 */ |
| 101 | res->nelem = 0; |
| 102 | |
| 103 | res->buckets = PyMem_Calloc(4 * (key_len + 1), sizeof(PyObject *)); |
| 104 | if (res->buckets == NULL) { |
| 105 | PyErr_NoMemory(); |
| 106 | PyMem_Free(res); |
| 107 | return NULL; |
| 108 | } |
| 109 | return res; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | NPY_NO_EXPORT void |
no outgoing calls
no test coverage detected