From patchwork Thu Apr 7 02:51:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 8] parsers: fix istat macro to work with single line if statement From: Jun Wu X-Patchwork-Id: 14415 Message-Id: <7f8180fe8ad6914bf09a.1459997492@waste.org> To: mercurial-devel@mercurial-scm.org Date: Wed, 06 Apr 2016 21:51:32 -0500 # HG changeset patch # User Matt Fowles # Date 1459867423 14400 # Tue Apr 05 10:43:43 2016 -0400 # Node ID 7f8180fe8ad6914bf09a5ed263bd7a4ba9f80f83 # Parent 44dabb24e6574461faad3c753bf88ec96cb3189d parsers: fix istat macro to work with single line if statement diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -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);