Patchwork D8317: cext: move more variable declarations to the top of the block for C89 support

login
register
mail settings
Submitter phabricator
Date March 21, 2020, 3:55 a.m.
Message ID <differential-rev-PHID-DREV-clg4lq3uivpyqb6pgcqc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45855/
State Superseded
Headers show

Comments

phabricator - March 21, 2020, 3:55 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  These instances aren't compiled on Windows, so they don't matter much.  But they
  do get flagged by `-Werror=declaration-after-statement` in the next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8317

AFFECTED FILES
  mercurial/cext/osutil.c

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - March 25, 2020, 8:41 p.m.
mharbison72 added a comment.
mharbison72 abandoned this revision.


  Duplicate of 0424a9134bcf <https://phab.mercurial-scm.org/rHG0424a9134bcfe08dffc9e5b5e63f1a7dd33d284b>

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8317/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8317

To: mharbison72, #hg-reviewers
Cc: mercurial-devel

Patch

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 @@ 
 			/* 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 */
@@ -1170,9 +1171,9 @@ 
 {
 	int sig = 0;
 	int r;
+	sigset_t set;
 	if (!PyArg_ParseTuple(args, "i", &sig))
 		return NULL;
-	sigset_t set;
 	r = sigemptyset(&set);
 	if (r != 0)
 		return PyErr_SetFromErrno(PyExc_OSError);