]> granicus.if.org Git - python/commitdiff
C++ compiler changes. casts, rename variables with reserved names.
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 13 Apr 2006 07:19:01 +0000 (07:19 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 13 Apr 2006 07:19:01 +0000 (07:19 +0000)
Modules/_hotshot.c
Modules/stropmodule.c
Modules/timemodule.c

index d5b4cde8f9e5830fc60274a6a53b8535b6a53d11..6a78fd2e494ec3f8894232f625801c119a3d8ef6 100644 (file)
@@ -308,7 +308,7 @@ unpack_string(LogReaderObject *self, PyObject **pvalue)
     if ((err = unpack_packed_int(self, &len, 0)))
         return err;
 
-    buf = malloc(len);
+    buf = (char *)malloc(len);
     for (i=0; i < len; i++) {
         ch = fgetc(self->logfp);
        buf[i] = ch;
@@ -1403,7 +1403,7 @@ get_version_string(void)
         ++rev;
     while (rev[i] != ' ' && rev[i] != '\0')
         ++i;
-    buffer = malloc(i + 1);
+    buffer = (char *)malloc(i + 1);
     if (buffer != NULL) {
         memmove(buffer, rev, i);
         buffer[i] = '\0';
index 2f671b6ac2a038acc0a1c973b15103e0269b3329..c1ad43a2f8cc6c06b57823b6cb202fb3ef3b9bd3 100644 (file)
@@ -446,16 +446,16 @@ strop_lower(PyObject *self, PyObject *args)
 {
        char *s, *s_new;
        Py_ssize_t i, n;
-       PyObject *new;
+       PyObject *newstr;
        int changed;
 
        WARN;
        if (PyString_AsStringAndSize(args, &s, &n))
                return NULL;
-       new = PyString_FromStringAndSize(NULL, n);
-       if (new == NULL)
+       newstr = PyString_FromStringAndSize(NULL, n);
+       if (newstr == NULL)
                return NULL;
-       s_new = PyString_AsString(new);
+       s_new = PyString_AsString(newstr);
        changed = 0;
        for (i = 0; i < n; i++) {
                int c = Py_CHARMASK(*s++);
@@ -467,11 +467,11 @@ strop_lower(PyObject *self, PyObject *args)
                s_new++;
        }
        if (!changed) {
-               Py_DECREF(new);
+               Py_DECREF(newstr);
                Py_INCREF(args);
                return args;
        }
-       return new;
+       return newstr;
 }
 
 
@@ -485,16 +485,16 @@ strop_upper(PyObject *self, PyObject *args)
 {
        char *s, *s_new;
        Py_ssize_t i, n;
-       PyObject *new;
+       PyObject *newstr;
        int changed;
 
        WARN;
        if (PyString_AsStringAndSize(args, &s, &n))
                return NULL;
-       new = PyString_FromStringAndSize(NULL, n);
-       if (new == NULL)
+       newstr = PyString_FromStringAndSize(NULL, n);
+       if (newstr == NULL)
                return NULL;
-       s_new = PyString_AsString(new);
+       s_new = PyString_AsString(newstr);
        changed = 0;
        for (i = 0; i < n; i++) {
                int c = Py_CHARMASK(*s++);
@@ -506,11 +506,11 @@ strop_upper(PyObject *self, PyObject *args)
                s_new++;
        }
        if (!changed) {
-               Py_DECREF(new);
+               Py_DECREF(newstr);
                Py_INCREF(args);
                return args;
        }
-       return new;
+       return newstr;
 }
 
 
@@ -525,16 +525,16 @@ strop_capitalize(PyObject *self, PyObject *args)
 {
        char *s, *s_new;
        Py_ssize_t i, n;
-       PyObject *new;
+       PyObject *newstr;
        int changed;
 
        WARN;
        if (PyString_AsStringAndSize(args, &s, &n))
                return NULL;
-       new = PyString_FromStringAndSize(NULL, n);
-       if (new == NULL)
+       newstr = PyString_FromStringAndSize(NULL, n);
+       if (newstr == NULL)
                return NULL;
-       s_new = PyString_AsString(new);
+       s_new = PyString_AsString(newstr);
        changed = 0;
        if (0 < n) {
                int c = Py_CHARMASK(*s++);
@@ -555,11 +555,11 @@ strop_capitalize(PyObject *self, PyObject *args)
                s_new++;
        }
        if (!changed) {
-               Py_DECREF(new);
+               Py_DECREF(newstr);
                Py_INCREF(args);
                return args;
        }
-       return new;
+       return newstr;
 }
 
 
@@ -691,16 +691,16 @@ strop_swapcase(PyObject *self, PyObject *args)
 {
        char *s, *s_new;
        Py_ssize_t i, n;
-       PyObject *new;
+       PyObject *newstr;
        int changed;
 
        WARN;
        if (PyString_AsStringAndSize(args, &s, &n))
                return NULL;
-       new = PyString_FromStringAndSize(NULL, n);
-       if (new == NULL)
+       newstr = PyString_FromStringAndSize(NULL, n);
+       if (newstr == NULL)
                return NULL;
-       s_new = PyString_AsString(new);
+       s_new = PyString_AsString(newstr);
        changed = 0;
        for (i = 0; i < n; i++) {
                int c = Py_CHARMASK(*s++);
@@ -717,11 +717,11 @@ strop_swapcase(PyObject *self, PyObject *args)
                s_new++;
        }
        if (!changed) {
-               Py_DECREF(new);
+               Py_DECREF(newstr);
                Py_INCREF(args);
                return args;
        }
-       return new;
+       return newstr;
 }
 
 
@@ -1141,7 +1141,7 @@ strop_replace(PyObject *self, PyObject *args)
        char *str, *pat,*sub,*new_s;
        Py_ssize_t len,pat_len,sub_len,out_len;
        Py_ssize_t count = -1;
-       PyObject *new;
+       PyObject *newstr;
 
        WARN;
        if (!PyArg_ParseTuple(args, "t#t#t#|n:replace",
@@ -1165,14 +1165,14 @@ strop_replace(PyObject *self, PyObject *args)
        }
        if (out_len == -1) {
                /* we're returning another reference to the input string */
-               new = PyTuple_GetItem(args, 0);
-               Py_XINCREF(new);
+               newstr = PyTuple_GetItem(args, 0);
+               Py_XINCREF(newstr);
        }
        else {
-               new = PyString_FromStringAndSize(new_s, out_len);
+               newstr = PyString_FromStringAndSize(new_s, out_len);
                PyMem_FREE(new_s);
        }
-       return new;
+       return newstr;
 }
 
 
index ba93957b8856c2b86b0f6d8630c2861c178a211b..7f762f31a1f915af673b6b04582b2cc80e9bcbe3 100644 (file)
@@ -443,7 +443,7 @@ time_strftime(PyObject *self, PyObject *args)
         * will be ahead of time...
         */
        for (i = 1024; ; i += i) {
-               outbuf = malloc(i);
+               outbuf = (char *)malloc(i);
                if (outbuf == NULL) {
                        return PyErr_NoMemory();
                }