summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-05-09 07:37:07 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-05-09 07:37:07 (GMT)
commit9e897f41db4b86e26fabd9f4c098b1d273ed4481 (patch)
treeb8bfe057ac530c880ebfdbbf40d14ae275cb53a2 /Objects/stringobject.c
parentaf922187ae05e244b33b6b95b1898abd7f208a79 (diff)
downloadcpython-9e897f41db4b86e26fabd9f4c098b1d273ed4481.zip
cpython-9e897f41db4b86e26fabd9f4c098b1d273ed4481.tar.gz
cpython-9e897f41db4b86e26fabd9f4c098b1d273ed4481.tar.bz2
Mark Favas reported that gcc caught me using casts as lvalues. Dodge it.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 8b51aab..65a28cb 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -36,7 +36,7 @@ static PyStringObject *nullstring;
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 @@ PyString_FromStringAndSize(const char *str, int size)
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 @@ PyObject *
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 @@ PyString_FromString(const char *str)
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);
}