| 1 | /* Set object interface */
|
|---|
| 2 |
|
|---|
| 3 | #ifndef Py_SETOBJECT_H
|
|---|
| 4 | #define Py_SETOBJECT_H
|
|---|
| 5 | #ifdef __cplusplus
|
|---|
| 6 | extern "C" {
|
|---|
| 7 | #endif
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 | /*
|
|---|
| 11 | There are three kinds of slots in the table:
|
|---|
| 12 |
|
|---|
| 13 | 1. Unused: key == NULL
|
|---|
| 14 | 2. Active: key != NULL and key != dummy
|
|---|
| 15 | 3. Dummy: key == dummy
|
|---|
| 16 |
|
|---|
| 17 | Note: .pop() abuses the hash field of an Unused or Dummy slot to
|
|---|
| 18 | hold a search finger. The hash field of Unused or Dummy slots has
|
|---|
| 19 | no meaning otherwise.
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | #define PySet_MINSIZE 8
|
|---|
| 23 |
|
|---|
| 24 | typedef struct {
|
|---|
| 25 | long hash; /* cached hash code for the entry key */
|
|---|
| 26 | PyObject *key;
|
|---|
| 27 | } setentry;
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | /*
|
|---|
| 31 | This data structure is shared by set and frozenset objects.
|
|---|
| 32 | */
|
|---|
| 33 |
|
|---|
| 34 | typedef struct _setobject PySetObject;
|
|---|
| 35 | struct _setobject {
|
|---|
| 36 | PyObject_HEAD
|
|---|
| 37 |
|
|---|
| 38 | Py_ssize_t fill; /* # Active + # Dummy */
|
|---|
| 39 | Py_ssize_t used; /* # Active */
|
|---|
|
|---|