parsers: use Py_CLEAR where appropriate
authorBryan O'Sullivan <bryano@fb.com>
Sun, 13 May 2012 11:56:50 +0200
changeset 16732 277e2acb7e5c
parent 16731 dcfc70aab372
child 16733 4da10c00a20c
parsers: use Py_CLEAR where appropriate
mercurial/parsers.c
--- a/mercurial/parsers.c	Sun May 13 12:11:50 2012 +0200
+++ b/mercurial/parsers.c	Sun May 13 11:56:50 2012 +0200
@@ -471,12 +471,8 @@
 	if (self->cache) {
 		Py_ssize_t i;
 
-		for (i = 0; i < self->raw_length; i++) {
-			if (self->cache[i]) {
-				Py_DECREF(self->cache[i]);
-				self->cache[i] = NULL;
-			}
-		}
+		for (i = 0; i < self->raw_length; i++)
+			Py_CLEAR(self->cache[i]);
 		free(self->cache);
 		self->cache = NULL;
 	}
@@ -922,10 +918,8 @@
 		nt_insert(self, PyString_AS_STRING(node), -1);
 	}
 
-	if (start == 0) {
-		Py_DECREF(self->added);
-		self->added = NULL;
-	}
+	if (start == 0)
+		Py_CLEAR(self->added);
 }
 
 /*