aboutsummaryrefslogtreecommitdiff
path: root/lutf8lib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-06 14:35:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-09-06 14:35:04 -0300
commit007b8c7a01eaa97d796561a19c7e9af1ec474495 (patch)
treed21133c450f4579b19a61f15fbf840e3fd82d097 /lutf8lib.c
parentfd0e1f530d06340f99334b07d74e5133ce073787 (diff)
downloadlua-007b8c7a01eaa97d796561a19c7e9af1ec474495.tar.gz
lua-007b8c7a01eaa97d796561a19c7e9af1ec474495.tar.bz2
lua-007b8c7a01eaa97d796561a19c7e9af1ec474495.zip
Details
Identation + comments
Diffstat (limited to 'lutf8lib.c')
-rw-r--r--lutf8lib.c32
1 files changed, 16 insertions, 16 deletions
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) {
192 if (iscontp(s + posi)) 192 if (iscontp(s + posi))
193 return luaL_error(L, "initial position is a continuation byte"); 193 return luaL_error(L, "initial position is a continuation byte");
194 if (n < 0) { 194 if (n < 0) {
195 while (n < 0 && posi > 0) { /* move back */ 195 while (n < 0 && posi > 0) { /* move back */
196 do { /* find beginning of previous character */ 196 do { /* find beginning of previous character */
197 posi--; 197 posi--;
198 } while (posi > 0 && iscontp(s + posi)); 198 } while (posi > 0 && iscontp(s + posi));
199 n++; 199 n++;
200 } 200 }
201 } 201 }
202 else { 202 else {
203 n--; /* do not move for 1st character */ 203 n--; /* do not move for 1st character */
204 while (n > 0 && posi < (lua_Integer)len) { 204 while (n > 0 && posi < (lua_Integer)len) {
205 do { /* find beginning of next character */ 205 do { /* find beginning of next character */
206 posi++; 206 posi++;
207 } while (iscontp(s + posi)); /* (cannot pass final '\0') */ 207 } while (iscontp(s + posi)); /* (cannot pass final '\0') */
208 n--; 208 n--;
209 } 209 }
210 } 210 }
211 } 211 }
212 if (n != 0) { /* did not find given character? */ 212 if (n != 0) { /* did not find given character? */
213 luaL_pushfail(L); 213 luaL_pushfail(L);