Patchwork D7877: sha1dc: declare all variables at begininng of block

login
register
mail settings
Submitter phabricator
Date Jan. 15, 2020, 1:17 p.m.
Message ID <f64d25f07497f176a861779175ff6cf1@localhost.localdomain>
Download mbox | patch
Permalink /patch/44358/
State Not Applicable
Headers show

Comments

phabricator - Jan. 15, 2020, 1:17 p.m.
Closed by commit rHGc3f741bb2f33: sha1dc: declare all variables at begininng of block (authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7877?vs=19276&id=19288

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

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

AFFECTED FILES
  mercurial/thirdparty/sha1dc/cext.c

CHANGE DETAILS




To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/thirdparty/sha1dc/cext.c b/mercurial/thirdparty/sha1dc/cext.c
--- a/mercurial/thirdparty/sha1dc/cext.c
+++ b/mercurial/thirdparty/sha1dc/cext.c
@@ -84,13 +84,14 @@ 
 
 static PyObject *pysha1ctx_hexdigest(pysha1ctx *self)
 {
+	static const char hexdigit[] = "0123456789abcdef";
 	unsigned char hash[20];
+	char hexhash[40];
+	int i;
 	if (!finalize(self->ctx, hash)) {
 		return NULL;
 	}
-	char hexhash[40];
-	static const char hexdigit[] = "0123456789abcdef";
-	for (int i = 0; i < 20; ++i) {
+	for (i = 0; i < 20; ++i) {
 		hexhash[i * 2] = hexdigit[hash[i] >> 4];
 		hexhash[i * 2 + 1] = hexdigit[hash[i] & 15];
 	}