]> granicus.if.org Git - python/commitdiff
Use Py_CLEAR().
authorGeorg Brandl <georg@python.org>
Thu, 29 Jul 2010 14:23:06 +0000 (14:23 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 29 Jul 2010 14:23:06 +0000 (14:23 +0000)
Objects/unicodeobject.c

index 43c827f981bc07a4a437b56b333dac3e7aa5a576..f2d666de126995be90578cb622bff9ddb6e94b52 100644 (file)
@@ -307,8 +307,7 @@ int unicode_resize(register PyUnicodeObject *unicode,
   reset:
     /* Reset the object caches */
     if (unicode->defenc) {
-        Py_DECREF(unicode->defenc);
-        unicode->defenc = NULL;
+        Py_CLEAR(unicode->defenc);
     }
     unicode->hash = -1;
 
@@ -427,8 +426,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
             unicode->length = 0;
         }
         if (unicode->defenc) {
-            Py_DECREF(unicode->defenc);
-            unicode->defenc = NULL;
+            Py_CLEAR(unicode->defenc);
         }
         /* Add to free list */
         *(PyUnicodeObject **)unicode = free_list;