diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-26 02:21:42 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-26 02:21:42 (GMT) |
commit | 312e10d63eaface69dbe3e4271545cb9c4429bed (patch) | |
tree | 896923c6b71e71a7a7150e9be0b4c1b2fc5b63a4 | |
parent | a9ea3d97782749ca522f58e699f2d09bd590109f (diff) | |
download | cpython-312e10d63eaface69dbe3e4271545cb9c4429bed.zip cpython-312e10d63eaface69dbe3e4271545cb9c4429bed.tar.gz cpython-312e10d63eaface69dbe3e4271545cb9c4429bed.tar.bz2 |
Get rid of more uses of string and use const in a few places.
-rw-r--r-- | Include/moduleobject.h | 4 | ||||
-rw-r--r-- | Objects/moduleobject.c | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Include/moduleobject.h b/Include/moduleobject.h index c43cb93..f50c729 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -14,8 +14,8 @@ PyAPI_DATA(PyTypeObject) PyModule_Type; PyAPI_FUNC(PyObject *) PyModule_New(const char *); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); -PyAPI_FUNC(char *) PyModule_GetName(PyObject *); -PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); +PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); +PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(void) _PyModule_Clear(PyObject *); #ifdef __cplusplus diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 6f7294a..19bb149 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -54,7 +54,7 @@ PyModule_GetDict(PyObject *m) return d; } -char * +const char * PyModule_GetName(PyObject *m) { PyObject *d; @@ -79,7 +79,7 @@ PyModule_GetName(PyObject *m) return PyString_AsString(nameobj); } -char * +const char * PyModule_GetFilename(PyObject *m) { PyObject *d; @@ -120,8 +120,8 @@ _PyModule_Clear(PyObject *m) /* First, clear only names starting with a single underscore */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyUnicode_Check(key)) { + const char *s = PyUnicode_AsString(key); if (s[0] == '_' && s[1] != '_') { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[1] %s\n", s); @@ -133,8 +133,8 @@ _PyModule_Clear(PyObject *m) /* Next, clear all names except for __builtins__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyUnicode_Check(key)) { + const char *s = PyUnicode_AsString(key); if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); @@ -187,8 +187,8 @@ module_dealloc(PyModuleObject *m) static PyObject * module_repr(PyModuleObject *m) { - char *name; - char *filename; + const char *name; + const char *filename; name = PyModule_GetName((PyObject *)m); if (name == NULL) { |