[PATCH] osutil: move declaration to top of the scope

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] osutil: move declaration to top of the scope

Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara <[hidden email]>
# Date 1584870004 -32400
#      Sun Mar 22 18:40:04 2020 +0900
# Node ID bbb3fc76b442292b20e5dccccf97ea462997eb5e
# Parent  a7f8c657a3f08d1e71ee112f797df011eea7a078
osutil: move declaration to top of the scope

Otherwise the build would fail with -Werror=declaration-after-statement.

diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c
--- a/mercurial/cext/osutil.c
+++ b/mercurial/cext/osutil.c
@@ -810,9 +810,10 @@ static PyObject *setprocname(PyObject *s
  /* Check the memory we can use. Typically, argv[i] and
  * argv[i + 1] are continuous. */
  for (i = 0; i < argc; ++i) {
+ size_t len;
  if (argv[i] > argvend || argv[i] < argvstart)
  break; /* not continuous */
- size_t len = strlen(argv[i]);
+ len = strlen(argv[i]);
  argvend = argv[i] + len + 1 /* '\0' */;
  }
  if (argvend > argvstart) /* sanity check */
@@ -1169,10 +1170,10 @@ static PyObject *getfsmountpoint(PyObjec
 static PyObject *unblocksignal(PyObject *self, PyObject *args)
 {
  int sig = 0;
+ sigset_t set;
  int r;
  if (!PyArg_ParseTuple(args, "i", &sig))
  return NULL;
- sigset_t set;
  r = sigemptyset(&set);
  if (r != 0)
  return PyErr_SetFromErrno(PyExc_OSError);
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] osutil: move declaration to top of the scope

Augie Fackler-2
Queued, thanks

> On Mar 22, 2020, at 08:39, Yuya Nishihara <[hidden email]> wrote:
>
> # HG changeset patch
> # User Yuya Nishihara <[hidden email]>
> # Date 1584870004 -32400
> #      Sun Mar 22 18:40:04 2020 +0900
> # Node ID bbb3fc76b442292b20e5dccccf97ea462997eb5e
> # Parent  a7f8c657a3f08d1e71ee112f797df011eea7a078
> osutil: move declaration to top of the scope
>
> Otherwise the build would fail with -Werror=declaration-after-statement.
>
> diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c
> --- a/mercurial/cext/osutil.c
> +++ b/mercurial/cext/osutil.c
> @@ -810,9 +810,10 @@ static PyObject *setprocname(PyObject *s
> /* Check the memory we can use. Typically, argv[i] and
> * argv[i + 1] are continuous. */
> for (i = 0; i < argc; ++i) {
> + size_t len;
> if (argv[i] > argvend || argv[i] < argvstart)
> break; /* not continuous */
> - size_t len = strlen(argv[i]);
> + len = strlen(argv[i]);
> argvend = argv[i] + len + 1 /* '\0' */;
> }
> if (argvend > argvstart) /* sanity check */
> @@ -1169,10 +1170,10 @@ static PyObject *getfsmountpoint(PyObjec
> static PyObject *unblocksignal(PyObject *self, PyObject *args)
> {
> int sig = 0;
> + sigset_t set;
> int r;
> if (!PyArg_ParseTuple(args, "i", &sig))
> return NULL;
> - sigset_t set;
> r = sigemptyset(&set);
> if (r != 0)
> return PyErr_SetFromErrno(PyExc_OSError);
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel