From 80a632ed266874fd29397529d4a2fb609ecedbf8 Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Sun, 23 Oct 2022 17:28:32 +0300 Subject: [PATCH] cleanup: reduce variable scopes in common.c Contributes to #9. --- src/libespeak-ng/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libespeak-ng/common.c b/src/libespeak-ng/common.c index ac402d66..5174ee14 100644 --- a/src/libespeak-ng/common.c +++ b/src/libespeak-ng/common.c @@ -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)); }