summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-19 02:45:37 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-19 02:45:37 (GMT)
commit90aa7646affbaee9628ca6ea6a702aec17b3b550 (patch)
treee820962e9658a92c7147b686f8aa88c7658c5949 /Objects/unicodeobject.c
parent99170a5dbf4cfee78b578672b6821e855f92594b (diff)
downloadcpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.zip
cpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.tar.gz
cpython-90aa7646affbaee9628ca6ea6a702aec17b3b550.tar.bz2
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6d1d069..5b94b0f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -313,7 +313,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
case SSTATE_INTERNED_MORTAL:
/* revive dead object temporarily for DelItem */
- Py_Refcnt(unicode) = 3;
+ Py_REFCNT(unicode) = 3;
if (PyDict_DelItem(interned, (PyObject *)unicode) != 0)
Py_FatalError(
"deletion of interned unicode string failed");
@@ -346,7 +346,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
else {
PyMem_DEL(unicode->str);
Py_XDECREF(unicode->defenc);
- Py_Type(unicode)->tp_free((PyObject *)unicode);
+ Py_TYPE(unicode)->tp_free((PyObject *)unicode);
}
}
@@ -360,7 +360,7 @@ int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length)
return -1;
}
v = (PyUnicodeObject *)*unicode;
- if (v == NULL || !PyUnicode_Check(v) || Py_Refcnt(v) != 1 || length < 0) {
+ if (v == NULL || !PyUnicode_Check(v) || Py_REFCNT(v) != 1 || length < 0) {
PyErr_BadInternalCall();
return -1;
}
@@ -1000,7 +1000,7 @@ PyObject *PyUnicode_FromObject(register PyObject *obj)
}
PyErr_Format(PyExc_TypeError,
"Can't convert '%.100s' object to str implicitly",
- Py_Type(obj)->tp_name);
+ Py_TYPE(obj)->tp_name);
return NULL;
}
@@ -1035,7 +1035,7 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
PyErr_Format(PyExc_TypeError,
"coercing to Unicode: need string or buffer, "
"%.80s found",
- Py_Type(obj)->tp_name);
+ Py_TYPE(obj)->tp_name);
goto onError;
}
@@ -1115,7 +1115,7 @@ PyObject *PyUnicode_Decode(const char *s,
if (!PyUnicode_Check(unicode)) {
PyErr_Format(PyExc_TypeError,
"decoder did not return an unicode object (type=%.400s)",
- Py_Type(unicode)->tp_name);
+ Py_TYPE(unicode)->tp_name);
Py_DECREF(unicode);
goto onError;
}
@@ -2351,7 +2351,7 @@ PyUnicode_EncodeUTF32(const Py_UNICODE *s,
}
done:
- result = PyString_FromStringAndSize(PyBytes_AS_STRING(v), Py_Size(v));
+ result = PyString_FromStringAndSize(PyBytes_AS_STRING(v), Py_SIZE(v));
Py_DECREF(v);
return result;
#undef STORECHAR
@@ -2615,7 +2615,7 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
}
done:
- result = PyString_FromStringAndSize(PyBytes_AS_STRING(v), Py_Size(v));
+ result = PyString_FromStringAndSize(PyBytes_AS_STRING(v), Py_SIZE(v));
Py_DECREF(v);
return result;
#undef STORECHAR
@@ -4367,7 +4367,7 @@ charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping,
char *outstart;
Py_ssize_t outsize = PyString_GET_SIZE(*outobj);
- if (Py_Type(mapping) == &EncodingMapType) {
+ if (Py_TYPE(mapping) == &EncodingMapType) {
int res = encoding_map_lookup(c, mapping);
Py_ssize_t requiredsize = *outpos+1;
if (res == -1)
@@ -4439,7 +4439,7 @@ int charmap_encoding_error(
/* find all unencodable characters */
while (collendpos < size) {
PyObject *rep;
- if (Py_Type(mapping) == &EncodingMapType) {
+ if (Py_TYPE(mapping) == &EncodingMapType) {
int res = encoding_map_lookup(p[collendpos], mapping);
if (res != -1)
break;
@@ -5482,7 +5482,7 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
PyErr_Format(PyExc_TypeError,
"sequence item %zd: expected str instance,"
" %.80s found",
- i, Py_Type(item)->tp_name);
+ i, Py_TYPE(item)->tp_name);
goto onError;
}
item = PyUnicode_FromObject(item);
@@ -6505,7 +6505,7 @@ unicode_encode(PyUnicodeObject *self, PyObject *args)
PyErr_Format(PyExc_TypeError,
"encoder did not return a bytes object "
"(type=%.400s)",
- Py_Type(v)->tp_name);
+ Py_TYPE(v)->tp_name);
Py_DECREF(v);
return NULL;
}
@@ -6647,12 +6647,12 @@ unicode_hash(PyUnicodeObject *self)
if (self->hash != -1)
return self->hash;
- len = Py_Size(self);
+ len = Py_SIZE(self);
p = self->str;
x = *p << 7;
while (--len >= 0)
x = (1000003*x) ^ *p++;
- x ^= Py_Size(self);
+ x ^= Py_SIZE(self);
if (x == -1)
x = -2;
self->hash = x;
@@ -8514,7 +8514,7 @@ PyObject *PyUnicode_Format(PyObject *format,
arglen = -1;
argidx = -2;
}
- if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
+ if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) &&
!PyUnicode_Check(args))
dict = args;
@@ -9120,7 +9120,7 @@ PyUnicode_InternInPlace(PyObject **p)
PyThreadState_GET()->recursion_critical = 0;
/* The two references in interned are not counted by refcnt.
The deallocator will take care of this */
- Py_Refcnt(s) -= 2;
+ Py_REFCNT(s) -= 2;
PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL;
}
@@ -9174,11 +9174,11 @@ void _Py_ReleaseInternedUnicodeStrings(void)
/* XXX Shouldn't happen */
break;
case SSTATE_INTERNED_IMMORTAL:
- Py_Refcnt(s) += 1;
+ Py_REFCNT(s) += 1;
immortal_size += s->length;
break;
case SSTATE_INTERNED_MORTAL:
- Py_Refcnt(s) += 2;
+ Py_REFCNT(s) += 2;
mortal_size += s->length;
break;
default: