~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to Include/setobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-07-06 16:52:42 UTC
  • mfrom: (1.2.1 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100706165242-2xv4i019r3et6c0j
Tags: 3.1.2+20100706-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.
  - Add debian/patches/overwrite-semaphore-check for Lucid buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#define PySet_MINSIZE 8
23
23
 
24
24
typedef struct {
25
 
        long hash;      /* cached hash code for the entry key */
26
 
        PyObject *key;
 
25
    long hash;      /* cached hash code for the entry key */
 
26
    PyObject *key;
27
27
} setentry;
28
28
 
29
29
 
33
33
 
34
34
typedef struct _setobject PySetObject;
35
35
struct _setobject {
36
 
        PyObject_HEAD
37
 
 
38
 
        Py_ssize_t fill;  /* # Active + # Dummy */
39
 
        Py_ssize_t used;  /* # Active */
40
 
 
41
 
        /* The table contains mask + 1 slots, and that's a power of 2.
42
 
         * We store the mask instead of the size because the mask is more
43
 
         * frequently needed.
44
 
         */
45
 
        Py_ssize_t mask;
46
 
 
47
 
        /* table points to smalltable for small tables, else to
48
 
         * additional malloc'ed memory.  table is never NULL!  This rule
49
 
         * saves repeated runtime null-tests.
50
 
         */
51
 
        setentry *table;
52
 
        setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
53
 
        setentry smalltable[PySet_MINSIZE];
54
 
 
55
 
        long hash;              /* only used by frozenset objects */
56
 
        PyObject *weakreflist;  /* List of weak references */
 
36
    PyObject_HEAD
 
37
 
 
38
    Py_ssize_t fill;  /* # Active + # Dummy */
 
39
    Py_ssize_t used;  /* # Active */
 
40
 
 
41
    /* The table contains mask + 1 slots, and that's a power of 2.
 
42
     * We store the mask instead of the size because the mask is more
 
43
     * frequently needed.
 
44
     */
 
45
    Py_ssize_t mask;
 
46
 
 
47
    /* table points to smalltable for small tables, else to
 
48
     * additional malloc'ed memory.  table is never NULL!  This rule
 
49
     * saves repeated runtime null-tests.
 
50
     */
 
51
    setentry *table;
 
52
    setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
 
53
    setentry smalltable[PySet_MINSIZE];
 
54
 
 
55
    long hash;                  /* only used by frozenset objects */
 
56
    PyObject *weakreflist;      /* List of weak references */
57
57
};
58
58
 
59
59
PyAPI_DATA(PyTypeObject) PySet_Type;
69
69
 
70
70
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
71
71
#define PyAnySet_CheckExact(ob) \
72
 
        (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
 
72
    (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
73
73
#define PyAnySet_Check(ob) \
74
 
        (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
75
 
          PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
76
 
          PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
 
74
    (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
 
75
      PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
 
76
      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
77
77
#define PySet_Check(ob) \
78
 
        (Py_TYPE(ob) == &PySet_Type || \
79
 
        PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
 
78
    (Py_TYPE(ob) == &PySet_Type || \
 
79
    PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
80
80
#define   PyFrozenSet_Check(ob) \
81
 
        (Py_TYPE(ob) == &PyFrozenSet_Type || \
82
 
          PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
 
81
    (Py_TYPE(ob) == &PyFrozenSet_Type || \
 
82
      PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
83
83
 
84
84
PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
85
85
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);