[PATCH] parser: fix istat macro to be safe in if statement
Augie Fackler
raf at durin42.com
Tue Apr 5 13:17:47 EDT 2016
On Tue, Apr 05, 2016 at 10:47:45AM -0400, Matthew Fowles Kulukundis wrote:
> # HG changeset patch
> # User Matt Fowles <matt.fowles at gmail.com>
> # Date 1459867218 14400
> # Tue Apr 05 10:40:18 2016 -0400
> # Node ID 4c4b71e261a805d2803106162214bf17771cedc2
> # Parent ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
> istat macro: fix to be safe in if statement
For those confused, Matt got confused by the pushgate output and
wasn't sure his message sent. This one is mailer-mangled.
>
> diff -r ff0d3b6b287f -r 4c4b71e261a8 mercurial/parsers.c
> --- a/mercurial/parsers.c Tue Mar 29 12:29:00 2016 -0500
> +++ b/mercurial/parsers.c Tue Apr 05 10:40:18 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);
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list