Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 17720:ede29ad6440a legacy-trunk
Mark Favas reported that gcc caught me using casts as lvalues. Dodge it.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Wed, 09 May 2001 07:37:07 +0000 |
| parents | 2a7cfc172a68 |
| children | 1dea431fb0a0 |
line wrap: on
line diff
--- a/Objects/stringobject.c Wed May 09 04:03:16 2001 +0000 +++ b/Objects/stringobject.c Wed May 09 07:37:07 2001 +0000 @@ -36,7 +36,7 @@ PyObject * PyString_FromStringAndSize(const char *str, int size) { - PyStringObject *op; + register PyStringObject *op; #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0 && (op = nullstring) != NULL) { #ifdef COUNT_ALLOCS @@ -73,11 +73,13 @@ op->ob_sval[size] = '\0'; #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0) { - PyString_InternInPlace(&(PyObject *)op); + PyObject *t = (PyObject *)op; + PyString_InternInPlace(&t); nullstring = op; Py_INCREF(op); } else if (size == 1 && str != NULL) { - PyString_InternInPlace(&(PyObject *)op); + PyObject *t = (PyObject *)op; + PyString_InternInPlace(&t); characters[*str & UCHAR_MAX] = op; Py_INCREF(op); } @@ -89,7 +91,7 @@ PyString_FromString(const char *str) { register size_t size = strlen(str); - PyStringObject *op; + register PyStringObject *op; if (size > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "string is too long for a Python string"); @@ -127,11 +129,13 @@ strcpy(op->ob_sval, str); #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0) { - PyString_InternInPlace(&(PyObject *)op); + PyObject *t = (PyObject *)op; + PyString_InternInPlace(&t); nullstring = op; Py_INCREF(op); } else if (size == 1) { - PyString_InternInPlace(&(PyObject *)op); + PyObject *t = (PyObject *)op; + PyString_InternInPlace(&t); characters[*str & UCHAR_MAX] = op; Py_INCREF(op); }
