cleanup: reduce variable scopes in common.c

Contributes to #9.
This commit is contained in:
Juho Hiltunen
2022-10-23 17:32:41 +03:00
parent 39ea6e3a90
commit 80a632ed26
+2 -2
View File
@@ -132,7 +132,6 @@ int utf8_in2(int *c, const char *buf, int backwards)
int c1;
int n_bytes;
int ix;
static const unsigned char mask[4] = { 0xff, 0x1f, 0x0f, 0x07 };
// find the start of the next/previous character
@@ -155,6 +154,7 @@ int utf8_in2(int *c, const char *buf, int backwards)
n_bytes = 3;
c1 &= mask[n_bytes];
int ix;
for (ix = 0; ix < n_bytes; ix++)
{
if (!*buf)
@@ -290,10 +290,10 @@ int Read4Bytes(FILE *f)
{
// Read 4 bytes (least significant first) into a word
int ix;
unsigned char c;
int acc = 0;
for (ix = 0; ix < 4; ix++) {
unsigned char c;
c = fgetc(f) & 0xff;
acc += (c << (ix*8));
}