changeset 16732:277e2acb7e5c

parsers: use Py_CLEAR where appropriate
author Bryan O'Sullivan <bryano@fb.com>
date Sun, 13 May 2012 11:56:50 +0200
parents dcfc70aab372
children 4da10c00a20c
files mercurial/parsers.c
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }
 
 /*