[PATCH] parsers: fix compiler errors on MSVC 2008

David Soria Parra dsp at experimentalworks.net
Thu Mar 20 12:26:10 CDT 2014


Matt Harbison <matt_harbison at yahoo.com> writes:

> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1395288119 14400
> #      Thu Mar 20 00:01:59 2014 -0400
> # Node ID e286ab22e46157e0d159982e85bf32d704c44420
> # Parent  131f7fe06e9ef6684a38f21df13289da1b891714
> parsers: fix compiler errors on MSVC 2008
>
> This broke in 3681de20b0a7.
>
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -1969,18 +1969,22 @@
>  
>  PyMODINIT_FUNC PyInit_parsers(void)
>  {
> +	PyObject *mod;
> +
>  	if (check_python_version() == -1)
>  		return;
> -	PyObject *mod = PyModule_Create(&parsers_module);
> +	mod = PyModule_Create(&parsers_module);
>  	module_init(mod);
>  	return mod;
>  }
>  #else
>  PyMODINIT_FUNC initparsers(void)
>  {
> +	PyObject *mod;
> +
>  	if (check_python_version() == -1)
>  		return;
> -	PyObject *mod = Py_InitModule3("parsers", methods, parsers_doc);
> +	mod = Py_InitModule3("parsers", methods, parsers_doc);
>  	module_init(mod);
>  }
>  #endif

Looks good to me. Generally speaking I would say we want to stick with
C89 whenever possible to ensure compatibility with ancient systems.


More information about the Mercurial-devel mailing list