]> granicus.if.org Git - python/commitdiff
Fix a compile warning missed during porting (wchar_t/char) and move a
authorBrian Curtin <brian.curtin@gmail.com>
Tue, 8 Jun 2010 20:57:52 +0000 (20:57 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Tue, 8 Jun 2010 20:57:52 +0000 (20:57 +0000)
variable declaration outside of a loop. #2810 was when this first went in.

PC/winreg.c

index 8f89a003336d20dadfc5bb3bbd868afeee0ab118..c134a352e0351962f5faa2b0e78bd34224a662ba 100644 (file)
@@ -1129,6 +1129,7 @@ PyEnumValue(PyObject *self, PyObject *args)
     int index;
     long rc;
     wchar_t *retValueBuf;
+    wchar_t *tmpBuf;
     BYTE *retDataBuf;
     DWORD retValueSize, bufValueSize;
     DWORD retDataSize, bufDataSize;
@@ -1161,7 +1162,6 @@ PyEnumValue(PyObject *self, PyObject *args)
     }
 
     while (1) {
-        wchar_t *tmp;
         Py_BEGIN_ALLOW_THREADS
         rc = RegEnumValueW(hKey,
                   index,
@@ -1177,13 +1177,13 @@ PyEnumValue(PyObject *self, PyObject *args)
             break;
 
         bufDataSize *= 2;
-        tmp = (char *)PyMem_Realloc(retDataBuf, bufDataSize);
-        if (tmp == NULL) {
+        tmpBuf = (wchar_t *)PyMem_Realloc(retDataBuf, bufDataSize);
+        if (tmpBuf == NULL) {
             PyErr_NoMemory();
             retVal = NULL;
             goto fail;
         }
-        retDataBuf = tmp;
+        retDataBuf = tmpBuf;
         retDataSize = bufDataSize;
         retValueSize = bufValueSize;
     }