]> granicus.if.org Git - python/commitdiff
Removed redundant casts to `char *`.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 28 Sep 2014 08:27:24 +0000 (11:27 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 28 Sep 2014 08:27:24 +0000 (11:27 +0300)
Corresponding functions now accept `const char *` (issue #1772673).

Modules/_cursesmodule.c
Modules/_decimal/_decimal.c
Modules/cjkcodecs/cjkcodecs.h
Modules/cjkcodecs/multibytecodec.c
Modules/pyexpat.c
Objects/bytesobject.c
Objects/floatobject.c
Objects/longobject.c
Objects/unicodeobject.c
Python/import.c

index 5ffce2f9541a2d0f8ad325ed468997d35b5251c3..6b778687e71dc7a8ea511e452878f39eea4b414e 100644 (file)
@@ -2675,7 +2675,7 @@ PyCurses_KeyName(PyObject *self, PyObject *args)
     }
     knp = keyname(ch);
 
-    return PyBytes_FromString((knp == NULL) ? "" : (char *)knp);
+    return PyBytes_FromString((knp == NULL) ? "" : knp);
 }
 #endif
 
index f00088736e65dc89bd38b6221cce5911d76e3ebf..169914c2f749a76a96401270cc5b865feee5fcf8 100644 (file)
@@ -5640,7 +5640,7 @@ PyInit__decimal(void)
             goto error; /* GCOV_NOT_REACHED */
         }
 
-        ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL));
+        ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL));
         Py_DECREF(base);
 
         /* add to module */
@@ -5672,7 +5672,7 @@ PyInit__decimal(void)
             goto error; /* GCOV_NOT_REACHED */
         }
 
-        ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL));
+        ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL));
         Py_DECREF(base);
 
         Py_INCREF(cm->ex);
index 25bab41cf3f837d4c0fa0272dbccaf341d705bd4..4cd20885ace8a222780e548d96d9b92aea970415 100644 (file)
@@ -362,7 +362,7 @@ importmap(const char *modname, const char *symbol,
     if (mod == NULL)
         return -1;
 
-    o = PyObject_GetAttrString(mod, (char*)symbol);
+    o = PyObject_GetAttrString(mod, symbol);
     if (o == NULL)
         goto errorexit;
     else if (!PyCapsule_IsValid(o, PyMultibyteCodec_CAPSULE_NAME)) {
index 74ecafd3d65fe08dc71669753b5456d03012bd08..31bb35fede1a8749e36c55d50c4c0fdef5581c19 100644 (file)
@@ -1269,10 +1269,10 @@ mbstreamreader_iread(MultibyteStreamReaderObject *self,
 
         if (sizehint < 0)
             cres = PyObject_CallMethod(self->stream,
-                            (char *)method, NULL);
+                            method, NULL);
         else
             cres = PyObject_CallMethod(self->stream,
-                            (char *)method, "i", sizehint);
+                            method, "i", sizehint);
         if (cres == NULL)
             goto errorexit;
 
index 9c21bed0177800c1506e61c41418b325b909979d..88984e705c21aad42694b17e17ec9b76eaf378f0 100644 (file)
@@ -1478,7 +1478,7 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
 
 
 static PyObject *
-newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
+newxmlparseobject(const char *encoding, const char *namespace_separator, PyObject *intern)
 {
     int i;
     xmlparseobject *self;
@@ -1932,8 +1932,7 @@ pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char
         return NULL;
     }
 
-    result = newxmlparseobject((char *)encoding, (char *)namespace_separator,
-                               intern);
+    result = newxmlparseobject(encoding, namespace_separator, intern);
     if (intern_decref) {
         Py_DECREF(intern);
     }
@@ -2074,7 +2073,7 @@ MODULE_INITFUNC(void)
     PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype);
 
     PyModule_AddStringConstant(m, "EXPAT_VERSION",
-                               (char *) XML_ExpatVersion());
+                               XML_ExpatVersion());
     {
         XML_Expat_Version info = XML_ExpatVersionInfo();
         PyModule_AddObject(m, "version_info",
@@ -2154,7 +2153,7 @@ MODULE_INITFUNC(void)
 
 #define MYCONST(name) \
     if (PyModule_AddStringConstant(errors_module, #name,               \
-                                   (char *)XML_ErrorString(name)) < 0) \
+                                   XML_ErrorString(name)) < 0)         \
         return NULL;                                                   \
     tmpnum = PyLong_FromLong(name);                                    \
     if (tmpnum == NULL) return NULL;                                   \
index 63d5a5c6c3c4241e1e3a5a01229020514c471d4d..4f2da4ca81f6d549e8fa06ee0c3bb7d212ad1185 100644 (file)
@@ -3403,7 +3403,7 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
     _Py_DEC_REFTOTAL;
     _Py_ForgetReference(v);
     *pv = (PyObject *)
-        PyObject_REALLOC((char *)v, PyBytesObject_SIZE + newsize);
+        PyObject_REALLOC(v, PyBytesObject_SIZE + newsize);
     if (*pv == NULL) {
         PyObject_Del(v);
         PyErr_NoMemory();
index 05b76795532063b70b753d8a3840b9225c2ad2a9..dceb55ef29625119b3c9985b4f0fec6e96ed0ec4 100644 (file)
@@ -2026,7 +2026,7 @@ _PyFloat_Pack4(double x, unsigned char *p, int le)
     }
     else {
         float y = (float)x;
-        const char *s = (char*)&y;
+        const unsigned char *s = (unsigned char*)&y;
         int i, incr = 1;
 
         if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x))
@@ -2162,7 +2162,7 @@ _PyFloat_Pack8(double x, unsigned char *p, int le)
         return -1;
     }
     else {
-        const char *s = (char*)&x;
+        const unsigned char *s = (unsigned char*)&x;
         int i, incr = 1;
 
         if ((double_format == ieee_little_endian_format && !le)
index 68dc85fa8fcc650c31acb54ba904c9583eb356e7..bb2eb17a09006b63e36770a490c0fb5f3d9ed8e8 100644 (file)
@@ -2312,7 +2312,7 @@ _PyLong_FromBytes(const char *s, Py_ssize_t len, int base)
     PyObject *result, *strobj;
     char *end = NULL;
 
-    result = PyLong_FromString((char*)s, &end, base);
+    result = PyLong_FromString(s, &end, base);
     if (end == NULL || (result != NULL && end == s + len))
         return result;
     Py_XDECREF(result);
index f5d7b78ba1ab84ec5f781d89da77cb6bf69b5145..5a3ccaf7b9abfa76a427a1b50f6bc36c6f588077 100644 (file)
@@ -727,7 +727,7 @@ resize_compact(PyObject *unicode, Py_ssize_t length)
     _Py_DEC_REFTOTAL;
     _Py_ForgetReference(unicode);
 
-    new_unicode = (PyObject *)PyObject_REALLOC((char *)unicode, new_size);
+    new_unicode = (PyObject *)PyObject_REALLOC(unicode, new_size);
     if (new_unicode == NULL) {
         _Py_NewReference(unicode);
         PyErr_NoMemory();
@@ -3483,7 +3483,7 @@ mbstowcs_errorpos(const char *str, size_t len)
     memset(&mbs, 0, sizeof mbs);
     while (len)
     {
-        converted = mbrtowc(&ch, (char*)str, len, &mbs);
+        converted = mbrtowc(&ch, str, len, &mbs);
         if (converted == 0)
             /* Reached end of string */
             break;
index 317bdf76532aa44f56ce91a3b93a1d439c8fc285..c3b9e12572a730b8d7c12934c8ebdc42bcef8723 100644 (file)
@@ -2064,7 +2064,7 @@ PyImport_AppendInittab(const char *name, PyObject* (*initfunc)(void))
 
     memset(newtab, '\0', sizeof newtab);
 
-    newtab[0].name = (char *)name;
+    newtab[0].name = name;
     newtab[0].initfunc = initfunc;
 
     return PyImport_ExtendInittab(newtab);