summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
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 1b35d4e273..4f0de1e24a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -54,7 +54,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Limit for the Unicode object free list */
-#define MAX_UNICODE_FREELIST_SIZE 1024
+#define PyUnicode_MAXFREELIST 1024
/* Limit for the Unicode object free list stay alive optimization.
@@ -62,7 +62,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
all objects on the free list having a size less than this
limit. This reduces malloc() overhead for small Unicode objects.
- At worst this will result in MAX_UNICODE_FREELIST_SIZE *
+ At worst this will result in PyUnicode_MAXFREELIST *
(sizeof(PyUnicodeObject) + KEEPALIVE_SIZE_LIMIT +
malloc()-overhead) bytes of unused garbage.
@@ -106,8 +106,8 @@ extern "C" {
static PyObject *interned;
/* Free list for Unicode objects */
-static PyUnicodeObject *unicode_freelist;
-static int unicode_freelist_size;
+static PyUnicodeObject *free_list;
+static int numfree;
/* The empty Unicode object is shared to improve performance. */
static PyUnicodeObject *unicode_empty;
@@ -313,10 +313,10 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
}
/* Unicode freelist & memory allocation */
- if (unicode_freelist) {
- unicode = unicode_freelist;
- unicode_freelist = *(PyUnicodeObject **)unicode;
- unicode_freelist_size--;
+ if (free_list) {
+ unicode = free_list;
+ free_list = *(PyUnicodeObject **)unicode;
+ numfree--;
if (unicode->str) {
/* Keep-Alive optimization: we only upsize the buffer,
never downsize it. */
@@ -386,7 +386,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
}
if (PyUnicode_CheckExact(unicode) &&
- unicode_freelist_size < MAX_UNICODE_FREELIST_SIZE) {
+ numfree < PyUnicode_MAXFREELIST) {
/* Keep-Alive optimization */
if (unicode->length >= KEEPALIVE_SIZE_LIMIT) {
PyMem_DEL(unicode->str);
@@ -398,9 +398,9 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
unicode->defenc = NULL;
}
/* Add to free list */
- *(PyUnicodeObject **)unicode = unicode_freelist;
- unicode_freelist = unicode;
- unicode_freelist_size++;
+ *(PyUnicodeObject **)unicode = free_list;
+ free_list = unicode;
+ numfree++;
}
else {
PyMem_DEL(unicode->str);
@@ -8033,7 +8033,7 @@ unicode_zfill(PyUnicodeObject *self, PyObject *args)
static PyObject*
unicode_freelistsize(PyUnicodeObject *self)
{
- return PyLong_FromLong(unicode_freelist_size);
+ return PyLong_FromLong(numfree);
}
#endif
@@ -9090,8 +9090,8 @@ void _PyUnicode_Init(void)
};
/* Init the implementation */
- unicode_freelist = NULL;
- unicode_freelist_size = 0;
+ free_list = NULL;
+ numfree = 0;
unicode_empty = _PyUnicode_New(0);
if (!unicode_empty)
return;
@@ -9127,7 +9127,7 @@ _PyUnicode_Fini(void)
}
}
- for (u = unicode_freelist; u != NULL;) {
+ for (u = free_list; u != NULL;) {
PyUnicodeObject *v = u;
u = *(PyUnicodeObject **)u;
if (v->str)
@@ -9135,8 +9135,8 @@ _PyUnicode_Fini(void)
Py_XDECREF(v->defenc);
PyObject_Del(v);
}
- unicode_freelist = NULL;
- unicode_freelist_size = 0;
+ free_list = NULL;
+ numfree = 0;
}
void