changeset 28792:507136150d2b

parsers: fix istat macro to work with single line if statement
author Matt Fowles <matt.fowles@gmail.com>
date Tue, 05 Apr 2016 10:43:43 -0400
parents 277b4e6938fa
children d30fdd6d1bf7
files mercurial/parsers.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Tue Apr 05 14:44:18 2016 +0300
+++ b/mercurial/parsers.c	Tue Apr 05 10:43:43 2016 -0400
@@ -1029,12 +1029,14 @@
 		return NULL;
 
 #define istat(__n, __d) \
-	t = PyInt_FromSsize_t(self->__n); \
-	if (!t) \
-		goto bail; \
-	if (PyDict_SetItemString(obj, __d, t) == -1) \
-		goto bail; \
-	Py_DECREF(t);
+	do { \
+		t = PyInt_FromSsize_t(self->__n); \
+		if (!t) \
+			goto bail; \
+		if (PyDict_SetItemString(obj, __d, t) == -1) \
+			goto bail; \
+		Py_DECREF(t); \
+	} while (0)
 
 	if (self->added) {
 		Py_ssize_t len = PyList_GET_SIZE(self->added);