[PATCH 6 of 6] parsers.c: don't use Py_XDECREF(foo) if foo is never NULL

Nicolas Dumazet nicdumz at gmail.com
Thu Aug 27 08:09:15 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1251376798 -7200
# Node ID a64a57bafe2a41c40711f08e39abd76abcba54b6
# Parent  db94fcccdc32e00906851addc469e6f7275ce274
parsers.c: don't use Py_XDECREF(foo) if foo is never NULL

When we know for a fact that a variable is not NULL, it is preferable
to use Py_DECREF over Py_XDECREF

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -110,12 +110,12 @@
 		start = cur + 1;
 		zero = NULL;
 
-		Py_XDECREF(node);
-		Py_XDECREF(file);
+		Py_DECREF(node);
+		Py_DECREF(file);
 		continue;
 	bail:
 		Py_XDECREF(node);
-		Py_XDECREF(file);
+		Py_DECREF(file);
 		return NULL;
 	}
 
@@ -231,7 +231,7 @@
 	Py_XDECREF(fname);
 	Py_XDECREF(cname);
 	Py_XDECREF(entry);
-	Py_XDECREF(parents);
+	Py_DECREF(parents);
 	return ret;
 }
 


More information about the Mercurial-devel mailing list