From 007b8c7a01eaa97d796561a19c7e9af1ec474495 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 6 Sep 2024 14:35:04 -0300 Subject: Details Identation + comments --- lutf8lib.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lutf8lib.c') diff --git a/lutf8lib.c b/lutf8lib.c index 04bbfa56..4c9784e0 100644 --- a/lutf8lib.c +++ b/lutf8lib.c @@ -192,22 +192,22 @@ static int byteoffset (lua_State *L) { if (iscontp(s + posi)) return luaL_error(L, "initial position is a continuation byte"); if (n < 0) { - while (n < 0 && posi > 0) { /* move back */ - do { /* find beginning of previous character */ - posi--; - } while (posi > 0 && iscontp(s + posi)); - n++; - } - } - else { - n--; /* do not move for 1st character */ - while (n > 0 && posi < (lua_Integer)len) { - do { /* find beginning of next character */ - posi++; - } while (iscontp(s + posi)); /* (cannot pass final '\0') */ - n--; - } - } + while (n < 0 && posi > 0) { /* move back */ + do { /* find beginning of previous character */ + posi--; + } while (posi > 0 && iscontp(s + posi)); + n++; + } + } + else { + n--; /* do not move for 1st character */ + while (n > 0 && posi < (lua_Integer)len) { + do { /* find beginning of next character */ + posi++; + } while (iscontp(s + posi)); /* (cannot pass final '\0') */ + n--; + } + } } if (n != 0) { /* did not find given character? */ luaL_pushfail(L); -- cgit v1.2.3-55-g6feb